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 |
|---|---|---|---|---|---|
"""
Copyright 2017-present Airbnb, 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 or agreed to in writing, sof... | airbnb/streamalert | streamalert_cli/manage_lambda/deploy.py | Python | apache-2.0 | 8,527 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as... | ESRC-CDRC/ckan-ckanext-pdfview | setup.py | Python | agpl-3.0 | 3,132 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Vimig Socrates <[email protected]>
# Copyright (C) 2016 Loreto Parisi <[email protected]>
# Copyright (C) 2016 Silvio Olivastri <[email protected]>
# Copyright (C) 2016 Radim Rehurek <[email protected]>
"""This script ... | napsternxg/gensim | gensim/scripts/word2vec2tensor.py | Python | gpl-3.0 | 3,850 |
"""
Support for Unifi WAP controllers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.unifi/
"""
import logging
import urllib
from homeassistant.components.device_tracker import DOMAIN
from homeassistant.const import CONF_HOST, CONF_USERN... | mikaelboman/home-assistant | homeassistant/components/device_tracker/unifi.py | Python | mit | 2,556 |
#
# File Header
#
# Define vowels
vowels = "aeiouAEIOU" #I solved the case sensitivity by adding the vowels in both lowercase and uppercase.
# Ask for word
word = input("Please enter a word: ")
if (originalword[0] in vowels):
print((originalword + endofvowel).capitalize())
else:
print((origina... | josiahhardacre/Week-Four-Assignment | pigify.py | Python | mit | 562 |
from PyQt5.QtWidgets import QWidget, QDialogButtonBox
from PyQt5.QtCore import QEvent, Qt
from .password_input_uic import Ui_PasswordInputWidget
class PasswordInputView(QWidget, Ui_PasswordInputWidget):
"""
The model of Navigation component
"""
def __init__(self, parent):
# construct from qtDe... | ucoin-io/cutecoin | src/sakia/gui/sub/password_input/view.py | Python | mit | 1,433 |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class NosuploadCom(XFSHoster):
__name__ = "NosuploadCom"
__type__ = "hoster"
__version__ = "0.31"
__pattern__ = r'http://(?:www\.)?nosupload\.com/\?d=\w{12}'
__description__ = """Nos... | Zerknechterer/pyload | module/plugins/hoster/NosuploadCom.py | Python | gpl-3.0 | 1,353 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-09-30 06:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('blog', '0001_initial'),
]
oper... | RebelBIrd/Blog | comments/migrations/0001_initial.py | Python | mit | 962 |
# Copyright 2021 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 or agreed to in writing, ... | tensorflow/neural-structured-learning | research/neural_clustering/__init__.py | Python | apache-2.0 | 770 |
import PyStatGen as pst
import yaml
import argparse
import time
from watcher import Watcher
def main():
prs = argparse.ArgumentParser(description='Generate the website anew.')
prs.add_argument('-c', '--conf', type=str,
default="example_configuration.yml", dest='conf_path',
... | olivierdeserres/dropbox-generator | __watch.py | Python | mit | 708 |
"""Creates beautiful visualizations of the publication database."""
import datetime
import sqlite3 as sql
import numpy as np
from astropy import log
from matplotlib import pyplot as plt
import matplotlib.patheffects as path_effects
import matplotlib as mpl
from matplotlib import style
import seaborn as sns
from kpub... | barentsen/exoplanet-charts | publication-stats/publications-per-year-k2.py | Python | mit | 3,121 |
# Copyright 2011 OpenStack LLC.
# 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... | openstack/murano-agent | muranoagent/common/config.py | Python | apache-2.0 | 3,423 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsImageCache.
.. 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.
"""
__a... | tomtor/QGIS | tests/src/python/test_qgsimagecache.py | Python | gpl-2.0 | 5,431 |
# $Id$
class main(wt.TemplateCode):
class request(wt.TemplateCode):
def main(self, template):
for (self.key, self.val) in self.req.params.items():
self.process(template)
class cookies(wt.TemplateCode):
def main(self, template):
for (self.key, self.val) in self.req.cookies.items():
... | jribbens/jonpy | example/wt/printenv.html.py | Python | mit | 504 |
""" Strategies to Traverse a Tree """
from __future__ import print_function, division
from .util import basic_fns
from sympy.strategies.core import chain, do_one
def top_down(rule, fns=basic_fns):
""" Apply a rule down a tree running it on the top nodes first """
return chain(rule, lambda expr: sall(top_down(... | drufat/sympy | sympy/strategies/traverse.py | Python | bsd-3-clause | 1,215 |
"""
*******************************************************
*
* plot_marginals - PLOT MARGINALS
*
* License: Apache 2.0
* Written by: Michael Slugocki
* Created on: September 10, 2018
* Last updated: September 18, 2018
*
*******************************************************
"""
######################... | SlugocM/bayesfit | bayesfit/plot_Marginals.py | Python | apache-2.0 | 2,285 |
#!/usr/bin/env python3
import sys
import os
import hashlib
def sha256_file(filepath):
sha256 = hashlib.sha256()
with open(filepath, "rb") as fh:
while True:
chunk = fh.read(4096)
if not chunk:
break
sha256.update(chunk)
return sha256.hexdigest()... | ghenga/ghenga-ui | utils/cachebust.py | Python | mit | 1,600 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0083_migrate_delta_4_switch_columns'),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.AlterField(
... | dimagi/commcare-hq | corehq/form_processor/migrations/0084_migrate_delta_5_alter_field.py | Python | bsd-3-clause | 509 |
__author__ = 'vesna'
| marinkaz/orange3 | Orange/canvas/report/tests/__init__.py | Python | bsd-2-clause | 21 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | blrm/openshift-tools | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_objectvalidator.py | Python | apache-2.0 | 53,161 |
from . import formats
from .core.format_manager import convert, format_manager
from .core.contents_manager import IPymdContentsManager
from .core.scripts import convert_files
__version__ = '0.1.2.dev0'
| bollwyvl/ipymd | ipymd/__init__.py | Python | bsd-3-clause | 204 |
# -*- coding: utf-8 -*-
from collections import namedtuple
from pprint import pprint as pp
OpInfo = namedtuple('OpInfo', 'prec assoc')
L, R = 'Left Right'.split()
ops = {
'^': OpInfo(prec=4, assoc=R),
'*': OpInfo(prec=3, assoc=L),
'/': OpInfo(prec=3, assoc=L),
'+': OpInfo(prec=2, assoc=L),
'-': O... | hugoallan9/programacionMatematica | Billy/tarea4.py | Python | gpl-3.0 | 4,536 |
"""A custom backend for testing."""
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
super(EmailBackend, self).__init__(*args, **kwargs)
self.test_outbox = []
def send_messages(self, email_messages):
... | openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/mail/custombackend.py | Python | apache-2.0 | 464 |
import subprocess
def isValidInkscape(executable):
try:
out = subprocess.check_output([executable, "--version"]).decode("utf-8")
parts = out.split(" ")
if parts[0] != "Inkscape":
return False
version = parts[1].split(".")
return int(version[0]) == 1
except Fi... | yaqwsx/PcbDraw | pcbdraw/convert_common.py | Python | mit | 1,100 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'SQLAlchemy',
'transaction',
'pyramid_tm',
'pyramid_d... | josuemontano/cms | spartan/setup.py | Python | gpl-3.0 | 1,286 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# This program is distrib... | pvint/Blender2MS3d | io_mesh_ms3d/export_ms3d.py | Python | gpl-2.0 | 11,954 |
from setuptools import setup, find_packages
setup(
name='viewdns',
version='0.1.0',
packages=find_packages(),
url='https://github.com/MiquelT/viewdns-api.git',
# install_requires=["PyCrypto", "asyncssh-unofficial"],
license='BSD',
author='MiquelTur',
author_email='[email protected]... | MiquelT/viewdns-api | setup.py | Python | bsd-3-clause | 490 |
# 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, software
# distributed under the... | openstack/zaqar | api-ref/source/conf.py | Python | apache-2.0 | 6,668 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Jeremiah Marks
# @Date: 2015-03-08 21:40:17
# @Last Modified 2015-03-09
# @Last Modified time: 2015-03-09 21:40:22
class NumChain2(object):
def __init__(self,targetValue, chainLength):
self.valuegoal=targetValue
self.linksgoal=chainLength
... | jeremiahmarks/dangerzone | scripts/python/numchain.py | Python | mit | 1,986 |
from django.contrib import admin, messages
from django.forms import ValidationError
from feincms.module.medialibrary.admin import MediaFileAdmin as MediaFileAdminOld
from feincms.module.medialibrary.forms import MediaFileAdminForm as MediaFileAdminFormOld
from feincms.module.medialibrary.models import MediaFile
from ... | glogiotatidis/masterfirefoxos | masterfirefoxos/base/admin.py | Python | mpl-2.0 | 1,834 |
# Copyright 2011 OpenStack LLC.
# 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... | bigfootproject/sahara | sahara/utils/wsgi.py | Python | apache-2.0 | 16,018 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pip.download
from pip.req import parse_requirements
from setuptools import setup
setup(name='ansible-toolkit',
version='1.3.2',
description='The missing Ansible tools',
url='http://github.com/dellis23/ansible-toolkit',
author='Daniel Ellis... | dellis23/ansible-toolkit | setup.py | Python | gpl-3.0 | 919 |
from camkifu.stone.stonesfinder import StonesFinder | ArnaudPel/CamKifu | src/camkifu/stone/__init__.py | Python | gpl-2.0 | 52 |
# (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible.modules.storage.netapp.netapp_e_auditlog import AuditLog
from units.modules.utils import AnsibleFailJson, ModuleTestCase, set_module_args
__metaclass__ = type
from units.compat import mock... | alxgu/ansible | test/units/modules/storage/netapp/test_netapp_e_auditlog.py | Python | gpl-3.0 | 10,758 |
def do_stuff():
a = 1
return a
| moreati/pytest-cov | tests/helper.py | Python | mit | 39 |
#!/usr/bin/env python
r"""
Produce a MagicPoint file from a text file with simple markup.
Markup:
directives (lines starting with .)
MagicPoint text (everything else)
You can use MagicPoint markup (lines starting with %), but that is discouraged.
You should know that \ is MagicPoint's escape character. If yo... | mgedmin/mgp2pdf | samples/pyconlt/source/makeslide.py | Python | gpl-2.0 | 10,287 |
"""
Distance computations (:mod:`scipy.spatial.distance`)
=====================================================
.. sectionauthor:: Damian Eads
Function reference
------------------
Distance matrix computation from a collection of raw observation vectors
stored in a rectangular array.
.. autosummary::
:toctree: g... | nmayorov/scipy | scipy/spatial/distance.py | Python | bsd-3-clause | 87,158 |
def test_filename(parser, data_file):
ledger = parser.parse_ledger(data_file("simple.dat"))
assert ledger.absolute_filename("test.dat") == data_file("test.dat")
| pcapriotti/pledger | tests/test_ledger.py | Python | mit | 169 |
__author__ = 'hd'
import socket
from socketcan import CanMessage
class CanSocket:
def __init__(self):
self.sock = None
def open(self, interface):
self.sock = socket.socket(socket.AF_CAN, socket.SOCK_RAW, socket.CAN_RAW)
#self.sock.setsockopt(socket.SOL_CAN_RAW, socket.CAN_RAW_LOOPBAC... | Bytewerk/balloon_opencm3_ws2812_can | python/socketcan/cansocket.py | Python | gpl-2.0 | 899 |
from flask_factory import Factory
create_app = Factory(__name__)
create_app.step('.db:init_db')
| Kroisse/flask-factory | tests/relative/web.py | Python | bsd-3-clause | 97 |
#!/usr/bin/python3
import sys
import os
import random
import time
FLAG = os.environ["TASK1_FLAG"]
OFFSET = random.randint(38, 42)
def get_correct():
return int(time.time()) + OFFSET
print("Download path <game server>/0c16c4dd438b0042c4d725fab588e648.py\n")
print("Oh! Look what time it is: " + str(int(time.time())... | google/google-ctf | 2020/hackceler8/match-pre-package/game/static/0c16c4dd438b0042c4d725fab588e648.py | Python | apache-2.0 | 691 |
#coding:utf-8
from sys import argv
script, jisuan0, user_name = argv
prompt = '>' #赋值
print "Hi %s, I'm the %s script." % (user_name,script) #输出程序名字(script)
print "I'd like to ask you a few questions."
print "Do you like me %s?" % user_name #输出第一个参数(user_name)
likes = raw_input(prompt) ... | Mbdn/Python-Beginner | ex14.3.py | Python | mit | 932 |
#!/usr/bin/python
#
# (c) 2013, RSD Services S.A
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | t0mk/ansible | lib/ansible/modules/system/java_cert.py | Python | gpl-3.0 | 10,044 |
# 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... | varunarya10/rally | rally/deploy/engines/existing.py | Python | apache-2.0 | 5,238 |
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Denis Kobozev
#
# 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.
#
# This pr... | dkobozev/tatlin | libtatlin/vector.py | Python | gpl-2.0 | 1,804 |
# 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, software
# distributed under t... | kogotko/carburetor | openstack_dashboard/dashboards/admin/snapshots/forms.py | Python | apache-2.0 | 2,471 |
# coding: utf-8
import os
import shutil
import tempfile
from common_unit_test import UnitTestCase
from nxdrive.logging_config import get_logger
from tests.common_unit_test import FILE_CONTENT
log = get_logger(__name__)
TEST_TIMEOUT = 60
class TestLocalPaste(UnitTestCase):
NUMBER_OF_LOCAL_FILES = 25
TEMP_FO... | ssdi-drive/nuxeo-drive | nuxeo-drive-client/tests/test_local_paste.py | Python | lgpl-2.1 | 9,284 |
# This file is part of the uPiot project, https://github.com/gepd/upiot/
#
# MIT License
#
# Copyright (c) 2017 GEPD
#
# 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, inc... | gepd/uPiotMicroPythonTool | commands/retrieve_all_files.py | Python | mit | 1,799 |
# Copyright 2015 Hewlett-Packard Corporation
# 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
#
# Unle... | lakshmisampath/searchlight | searchlight/tests/unit/v1/test_search.py | Python | apache-2.0 | 33,311 |
#!/usr/bin/env python3
# Copyright (c) 2016 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.
'''Unit tests for grit.format.gzip_string'''
from __future__ import print_function
import gzip
import io
import os
import sys
if... | nwjs/chromium.src | tools/grit/grit/format/gzip_string_unittest.py | Python | bsd-3-clause | 1,844 |
#!/usr/bin/env python
'''
some useful wx widgets
Andrew Tridgell
June 2012
'''
import wx
class ImagePanel(wx.Panel):
'''a resizable panel containing an image'''
def __init__(self, parent, img):
wx.Panel.__init__(self, parent, -1, size=(1, 1))
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
... | Inspirati/freeMixer | Tools/MAVLink/MAVProxy/modules/lib/mp_widgets.py | Python | gpl-3.0 | 726 |
# -*- coding: utf-8 -*-
"""
eventlogging.parse
~~~~~~~~~~~~~~~~~~
This module provides a scanf-like parser for raw log lines.
The format specifiers hew closely to those accepted by varnishncsa.
See the `varnishncsa documentation <https://www.varnish-cache.org
/docs/trunk/reference/varnishncsa.html>`_ for ... | Facerafter/starcitizen-tools | extensions/EventLogging/server/eventlogging/parse.py | Python | gpl-3.0 | 5,715 |
# Copyright (C) 2012 Nippon Telegraph and Telephone 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Neil741/ryu-master | ryu/app/ofctl_rest.py | Python | apache-2.0 | 24,075 |
#!/usr/bin/env python
# Copyright (c) 2013-2014 ZUYD Research
# 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 li... | robertjacobs/zuros | zuros_control/zuros_emergency_stop/src/emergency_stop.py | Python | mit | 3,303 |
# Copyright (C) 2014 Andrey Antukh <[email protected]>
# Copyright (C) 2014 Jesús Espino <[email protected]>
# Copyright (C) 2014 David Barragán <[email protected]>
# This program 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 F... | rajiteh/taiga-back | taiga/timeline/timeline_implementations.py | Python | agpl-3.0 | 4,003 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mytype.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflec... | pkhopper/whatever | src/pbbox/messages/mytype_pb2.py | Python | mit | 9,888 |
# -*- coding: utf-8 -*-
#
# gapic-google-cloud-logging-v2 documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default;... | eoogbe/api-client-staging | generated/python/gapic-google-cloud-logging-v2-docs/docs/conf.py | Python | bsd-3-clause | 10,297 |
import json
from array import array
class dsf_geom_load (object):
def __init__ (self):
pass
@classmethod
def intern_geometry (self, jdata):
v = array ('f')
f = list ()
m = array ('i')
g = array ('i')
for vertex in jdata['vertices']['values']:
v.extend (vertex)
group_list = jdat... | 337529542/dsf-utils | dsf_geom_load.py | Python | gpl-3.0 | 1,353 |
from .boolean_objects import L
from .shortcuts import and_, or_, is_boolean_formula
__all__ = ["L", "and_", "or_", "is_boolean_formula"]
| aubreystarktoller/lite-boolean-formulae | lite_boolean_formulae/__init__.py | Python | bsd-3-clause | 138 |
from django.contrib import admin
from book.models import Book, Author, Publisher
class BookAdmin(admin.ModelAdmin):
list_display = ('title',)
admin.site.register(Book, BookAdmin)
class AuthorAdmin(admin.ModelAdmin):
list_display = ('name',)
admin.site.register(Author, AuthorAdmin)
class PublisherAdmin(adm... | fredwulei/fredsneverland | fredsneverland/book/admin.py | Python | mit | 412 |
# Copyright 2012-2017 The Meson development team
# 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 agree... | becm/meson | mesonbuild/compilers/objc.py | Python | apache-2.0 | 4,047 |
import sys
import argparse
def josephus(n, k):
""" Function that calculates the last person location
of the josephus problem
Args:
n(int): number of people in circle
k(int): step rate
Returns:
int: index value of the winner
"""
# special case, k = 1
if k == 1... | ashm2/josephus_problem | josephus.py | Python | mit | 1,843 |
from __future__ import division, absolute_import
import astropy.stats
import glob
import math
import matplotlib.pyplot as plt
from matplotlib import ticker
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import os
import pandas as pd
from scipy import integrate,optimize,spatial
from matplotlib i... | hrichstein/Stellar_mass_env_Density | Codes/Scripts/mean_halo_frac_all.py | Python | mit | 17,978 |
# Copyright (C) 2014 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 l... | encukou/pytest-beakerlib | pytest_beakerlib.py | Python | gpl-3.0 | 7,047 |
import numpy as np
from flux_accumulator import AccumulatorBase
class FluxHistogramBins(AccumulatorBase):
def __init__(self, dims, ranges, filename=''):
self.ar_flux = np.zeros(dims)
self.dims = dims
self.filename = filename
self.ranges = ranges
self.bin_sizes = np.abs(ran... | yishayv/lyacorr | flux_histogram_bins.py | Python | mit | 2,804 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para piratestreaming
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
# ------------------------------------------------------------
import re
import urlparse
from core import config
f... | dentaku65/plugin.video.sod | channels/guardarefilm.py | Python | gpl-3.0 | 12,690 |
try:
from functools import wraps
except ImportError:
# for python < 2.5... this is a limited set of what we need to do
# with a wrapped function :
def wraps(f):
def wrap_with_f(new_f):
new_f.__name__ = f.__name__
if hasattr(f, '__module__'):
new_f.__modul... | mozilla/betafarm | vendor-local/lib/python/fudge/util.py | Python | bsd-3-clause | 1,070 |
# Copyright 2020, The TensorFlow Privacy 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 ... | tensorflow/privacy | tensorflow_privacy/__init__.py | Python | apache-2.0 | 5,379 |
import numpy as np
from sklearn.ensemble import EnsembleSelectionClassifier
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn import cross_validation
fr... | RTHMaK/RPGOne | 9fe63d5a5f481b6256eb-e754b90d9aea15fe2dabd2e60a35ae0c502c2707/ensemble_selection_demo.py | Python | apache-2.0 | 4,721 |
# 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... | tensorflow/tensorflow | tensorflow/python/framework/gpu_util.py | Python | apache-2.0 | 2,063 |
#!/usr/bin/env python
# −*− coding: UTF−8 −*−
# Topological Sorting
from collections import defaultdict
def topsort(graph):
if not graph:
return []
# 1. Count every node's dependencies
count = defaultdict(int)
for node in graph:
for dependency in graph[node]:
count[depende... | pgularski/snippets | python/algorithms/topsort.py | Python | mit | 1,733 |
# # # # #
# keys.py
#
# This file is used to serve up
# RESTful links that can be
# consumed by a frontend system
#
# University of Illinois/NCSA Open Source License
# Copyright (c) 2015 Information Trust Institute
# All rights reserved.
#
# Developed by:
#
# Information Trust Institute
# University of Illinois
# http:... | GridProtectionAlliance/ARMORE | source/webServer/domains/support/keys.py | Python | mit | 4,993 |
# Copyright 2020 Google LLC. 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 a... | tensorflow/tfx | tfx/components/base/executor_spec.py | Python | apache-2.0 | 1,599 |
from index import *
from admin import *
from news_mgr import *
from store import *
#from schedule import *
| zknight/booster | booster/views/__init__.py | Python | mit | 107 |
import datetime
import logging
import pytz
from openstates.scrape import Scraper, Event
from .apiclient import OregonLegislatorODataClient
from .utils import SESSION_KEYS
logger = logging.getLogger("openstates")
class OREventScraper(Scraper):
_TZ = pytz.timezone("US/Pacific")
_DATE_FORMAT = "%Y-%m-%dT%H:%M:... | sunlightlabs/openstates | scrapers/or/events.py | Python | gpl-3.0 | 2,975 |
from contextlib import contextmanager
from django.conf import settings
from django.db.models.sql.compiler import SQLCompiler
class WouldSelectMultipleTablesForUpdate(Exception):
pass
def replacement_as_sql(self, *args, **kwargs):
sql = self.query_lock_limiter_old_as_sql(*args, **kwargs)
# We're doing th... | ArabellaTech/drf_tweaks | drf_tweaks/test_utils/lock_limiter.py | Python | mit | 2,023 |
from ctypeslib.codegen import typedesc
class Func:
def __init__(self, func):
self.name = func.name
self.returns = self._parse_type_arg(func.returns)
self.args = [self._parse_type_arg(arg) for arg in func.iterArgTypes()]
def signature(self):
return "%s %s(%s)" % (self.returns, s... | cournape/cython-codegen | cycodegenlib/codegenlib.py | Python | mit | 1,660 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Matt Makai <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the ... | mapennell/ansible | notification/sendgrid.py | Python | gpl-3.0 | 4,781 |
import math
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
if not head or not head.next:
return True
length = 0
forward = head
backward = head
while forward:
forward = for... | andy-sheng/leetcode | 234-Palindrome-Linked-List.py | Python | mit | 998 |
#!/usr/bin/env python
# Copyright 2015, Kay Hayen, mailto:[email protected]
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | wfxiang08/Nuitka | misc/make-doc.py | Python | apache-2.0 | 4,137 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
import sys
from Muon.GUI.Common.muon_load_dat... | mganeva/mantid | scripts/test/Muon/frequency_domain_context_test.py | Python | gpl-3.0 | 2,194 |
import os
import random
import time
import pytest
from ufo2ft.fontInfoData import (
dateStringToTimeValue,
getAttrWithFallback,
normalizeStringForPostscript,
)
@pytest.fixture
def info(InfoClass):
self = InfoClass()
self.familyName = "Family Name"
self.styleName = "Style Name"
self.units... | jamesgk/ufo2fdk | tests/fontInfoData_test.py | Python | mit | 8,670 |
"""Database abstraction layer
webdb is a database abstraction layer inspired by web2py's DAL. The goal
of webdb is to be more succinct and offer better cross-table integration.
Use the connect method to open a database connection.
>>> mydb = DB.connect('sqlite','path/to/database.sqlite') # doctest: +ELLIPSIS
Traceb... | orbnauticus/silk | silk/webdb/__init__.py | Python | bsd-3-clause | 30,145 |
# MJPEG Video Recording on Movement Example
#
# Note: You will need an SD card to run this example.
#
# You can use your OpenMV Cam to record mjpeg files. You can either feed the
# recorder object JPEG frames or RGB565/Grayscale frames. Once you've finished
# recording a Mjpeg file you can use VLC to play it. If you ar... | openmv/openmv | scripts/examples/OpenMV/06-Video-Recording/mjpeg_on_movement.py | Python | mit | 2,093 |
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('repo_manage.views',
url(r'^$', 'index', name='index'),
url(r'^create/$', 'repo_simple_new', name='repo_simple_new'),
url(r'^create/settings/$', 'repo_new', name='repo_new'),
url(r'^(?P<user_name>\w+)/$', 'repo_list', name='rep... | vault/bugit | repo_manage/urls.py | Python | mit | 825 |
# -*- coding: utf-8 -*-
import os
import pytest
import sqlalchemy as sa
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy_defaults import make_lazy_configured
@pytest.fixture(scope='session')
def dsn():
return os.... | kvesteri/sqlalchemy-defaults | tests/conftest.py | Python | bsd-3-clause | 1,185 |
""" CommandLine - Get and parse command line options
NOTE: This still is very much work in progress !!!
Different version are likely to be incompatible.
TODO:
* Incorporate the changes made by (see Inbox)
* Add number range option using srange()
"""
__copyright__ = """\
Copyright (c), 1997-200... | jlspyaozhongkai/Uter | third_party_backup/Python-2.7.9/Tools/pybench/CommandLine.py | Python | gpl-3.0 | 16,672 |
#!/usr/bin/env python
#
# Creates .wxs files to be used to generate multiple MSI targets
#
# by default the script will check for dist and enterprise-dist, and parse
# the version as needed options are provided to give a build version that will
# download the zip, drop in to dist/enterprise-dist and do the same thing
#... | grafana/grafana | scripts/build/ci-msi-build/msigenerator/generator/build.py | Python | agpl-3.0 | 14,202 |
import sublime
import unittest
import os
import sys
class TestImport(unittest.TestCase):
mpath = None
@classmethod
def setUpClass(cls):
basedir = os.path.dirname(__file__)
mpath = os.path.normpath(os.path.join(
basedir, "..", "st3_{}_{}".format(sublime.platform(), sublime.arc... | dmilith/SublimeText3-dmilith | Packages/Debugger/modules/libs/pywinpty/tests/test_import.py | Python | mit | 909 |
# coding: utf-8
__author__ = 'AS126'
from urllib.request import *
import random
def reqs(url, encode='utf-8'):
request = Request(url)
ua_list = [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2467.2 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) ... | fourstring/free-vip-getter | sources/req.py | Python | gpl-2.0 | 729 |
#!env/bin/python
import os
os.system('babel extract -F babel.cfg -k lazy_gettext -o messages.pot app')
os.system('babel init -i messages.pot -d app/locale -l ru')
os.unlink('messages.pot')
| dnaroid/laser-server | tr_init.py | Python | bsd-3-clause | 190 |
import numpy as np
from math import sqrt
# nice trick numpy
float_formatter = lambda x: "%.2f" % x
np.set_printoptions(formatter={'float_kind':float_formatter})
def euclidean_distance(a, b):
"""
Calculate the Euclidean distance of two vectors
"""
distance = 0
for x, y in zip(a, b):
distanc... | omartrinidad/schiffsdiebe | schiffsdiebe/clustering/dbscan/dbscan.py | Python | mit | 2,216 |
# coding: utf8
# skwinsec.py
# 12/11/2012 jichi
# Windows only
SE_DEBUG_PRIVILEGE = 'SeDebugPrivilege'
SE_TIMEZONE_PRIVILEGE = 'SeTimeZonePrivilege'
import skos
if skos.WIN:
import os
import win32api, win32con, win32security
import skwin, skwinapi
from skdebug import dprint, dwarn
# See: http://code.msdn.m... | Dangetsu/vnr | Frameworks/Sakura/py/libs/sakurakit/skwinsec.py | Python | gpl-3.0 | 9,300 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 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... | egabancho/invenio-ext | invenio_ext/email/__init__.py | Python | gpl-2.0 | 20,022 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
from tiles.urls import load_namespaced_urls
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'devdash.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'core.views.... | dgreisen-cfpb/pantheon | devdash/devdash/urls.py | Python | cc0-1.0 | 795 |
# 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 django.conf import settings
from django.http import HttpResponseRedirect
from django.shortcuts import render as dja... | mmmavis/lightbeam-bedrock-website | lib/l10n_utils/__init__.py | Python | mpl-2.0 | 2,249 |
#!/usr/bin/python2.7
# encoding: utf-8
# Copyright 2010 Google 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 ... | groschovskiy/personfinder | tests/test_main.py | Python | apache-2.0 | 3,414 |
from __future__ import absolute_import, unicode_literals
from ...util.path import Path
from ..via_template import ViaTemplateActivator
class CShellActivator(ViaTemplateActivator):
@classmethod
def supports(cls, interpreter):
return interpreter.os != "nt"
def templates(self):
yield Path(... | pybuilder/pybuilder | src/main/python/pybuilder/_vendor/virtualenv/activation/cshell/__init__.py | Python | apache-2.0 | 336 |
# 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/v2020_04_01/operations/_subnets_operations.py | Python | mit | 36,140 |
##############################################################################
#
# Copyright (c) 2009 Albert Cervera i Areny <[email protected]>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting f... | jeffery9/mixprint_addons | jasper_reports/JasperReports/RecordDataGenerator.py | Python | agpl-3.0 | 5,047 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.