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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2017 CERN.
#
# Zenodo 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 v... | slint/zenodo | zenodo/modules/records/serializers/schemas/geojson.py | Python | gpl-2.0 | 2,283 |
#!/usr/bin/env python
"""
<Program Name>
interface.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
January 5, 2017.
<Copyright>
See LICENSE for licensing information.
<Purpose>
Provide an interface to the cryptography funtions available in
securesystemslib. The interface can be used wi... | vladimir-v-diaz/securesystemslib | securesystemslib/interface.py | Python | mit | 28,823 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | trunglq7/horizon | openstack_dashboard/dashboards/project/overview/views.py | Python | apache-2.0 | 1,257 |
#-------------------------------------------------------------------------------
# Name: Largest Product in a Series
# Purpose: The four adjacent digits in the 1000-digit number (provided in
# textfile 'q008.txt') that have the greatest product are
# 9 x 9 x 8 x 9 = 5832. Find the... | alexadusei/ProjectEuler | q008.py | Python | mit | 1,143 |
"""Extra xpath functions inspired by:
https://gist.github.com/shirk3y/458224083ce5464627bc
"""
from lxml import etree
from scrapy.utils.misc import arg_to_iter
_XPATH_FUNCS = {}
_HASCLASS_EXPR = 'contains(concat(" ", @class, " "), " {} ")'
def register(func):
fname = func.func_name.replace('_', '-')
... | seagatesoft/data-terbuka-id | data_terbuka_id/utils/xpathfuncs.py | Python | mit | 993 |
# -*- coding: utf-8 -*-
#
#
def feed_catchup(pool, dbi = None):
from lib import DB
if dbi is None: _dbi = DB()
else: _dbi = dbi
if dbi is None: _dbi.disconnect()
def dispatch_catchup(self, payload):
"""處理 responses 中解析失敗的資料"""
raise Exception('Not Implemented, yet')
| wenh123/news-diff | lib/proc/catchup.py | Python | mit | 303 |
# Copyright 2019 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... | ament/ament_lint | ament_clang_tidy/test/test_copyright.py | Python | apache-2.0 | 805 |
import os
import logging
from jsub.loader import load_class
from jsub.util import snake_to_camel
from jsub.config.error import UnknownConfigFormatError
from jsub.config.error import ConfigFileNotFoundError
_GUESS_CONFIG_FORMAT = ('yaml', 'json', 'toml', 'py')
_jsub_logger = logging.getLogger('JSUB')
def _file_e... | jsubpy/jsub | jsub/config/__init__.py | Python | mit | 2,444 |
# This is the class you derive to create a plugin
from airflow.plugins_manager import AirflowPlugin
from flask import Blueprint
from flask_admin import BaseView, expose
from flask_admin.base import MenuLink
# Importing base classes that we need to derive
from airflow.hooks.base_hook import BaseHook
from airflow.model... | vipul-tm/DAG | plugins-ttpl/rules.py | Python | bsd-3-clause | 6,781 |
from lib.bluetooth_socket import BlueToothSocket
#from lib.tcp_socket import TCPSocket
HOST = ''
PORT = 1 #50001
Socket = BlueToothSocket #TCPSocket
MEDIUM_MOTOR_SPEED = 500
MEDIUM_MOTOR_ROTATION_ANGLE = 115
'''
stage 0: [[left speed, right speed, time], [left speed, right speed, time], ...],
stage 1: [[left speed, ... | projeto-si-lansab/si-lansab | Launcher/TS04/lego/lego/config.py | Python | gpl-2.0 | 611 |
'''
CheckBox
========
.. versionadded:: 1.4.0
.. image:: images/checkbox.png
:align: right
:class:`CheckBox` is a specific two-state button that can be either checked or
unchecked. If the CheckBox is in a Group, it becomes a Radio button.
As with the :class:`~kivy.uix.togglebutton.ToggleButton`, only one Radio b... | Davideddu/kivy-forkedtouch | kivy/uix/checkbox.py | Python | mit | 3,309 |
# -*- 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 ... | inspirehep/inspire-dojson | inspire_dojson/common/__init__.py | Python | gpl-3.0 | 1,035 |
#-*- coding: utf-8 -*-
"""
Utils related to the videos.
"""
import logging
from urlparse import urljoin
import requests
from django.conf import settings
from django.core.files.images import get_image_dimensions
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils.translation import ugettext ... | jolyonb/edx-platform | cms/djangoapps/contentstore/video_utils.py | Python | agpl-3.0 | 6,523 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Nicolas P. Rougier
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
""" """
from . raw_tr... | duyuan11/glumpy | glumpy/graphics/collections/triangle_collection.py | Python | bsd-3-clause | 633 |
# -*- coding: utf-8 -*-
# Copyright 2013 Dev in Cachu 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 unittest
from django import forms as django_forms
from .. import models, forms
class ParticipanteFormTestCase(unittest.Te... | devincachu/devincachu-2013 | devincachu/inscricao/tests/test_form_participante.py | Python | bsd-2-clause | 1,285 |
# -*- coding: utf-8 -*-
"""
Extension that adjust project file tree to include a namespace package.
This extension adds a **namespace** option to
:obj:`~pyscaffold.api.create_project` and provides correct values for the
options **root_pkg** and **namespace_pkg** to the following functions in the
action list.
"""
from ... | cpaulik/pyscaffold | src/pyscaffold/extensions/namespace.py | Python | mit | 5,349 |
from __future__ import print_function
import os
import argparse
import re
import six
import yaml
DEFAULT_CONFIG_FILE = 'ynab.yaml'
class ConfigEnvArgumentParser(argparse.ArgumentParser):
def __init__(self, *args, **kwargs):
super(ConfigEnvArgumentParser, self).__init__(*args, **kwargs)
try:
... | rienafairefr/pynYNAB | pynYNAB/scripts/helpers.py | Python | mit | 2,659 |
from distutils.core import setup
setup(
name='RancherOSIntegrationTests',
version='0.1',
packages=[
'rancherostest'
],
license='ASL 2.0',
long_description=open('README.txt').read(),
)
| maxfierke/rancher-os | tests/integration/setup.py | Python | apache-2.0 | 217 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/corellia/rogue_bageraset.py | Python | lgpl-3.0 | 1,657 |
## protocol.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## 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... | jabber-at/python-nbxmpp | nbxmpp/protocol.py | Python | gpl-3.0 | 76,532 |
from __future__ import absolute_import, division, print_function, unicode_literals
from flask import Blueprint, Flask, jsonify, \
request, abort, make_response, url_for, \
send_from_directory, send_file, current_app
from flask_sqlalchemy import SQLAlchemy
#from flask_sqlalchemy import get_debug_queries
from sql... | diegovalle/hoyodecrimen.api | wsgi/api/api.py | Python | gpl-3.0 | 96,766 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from xmlrpclib import Server, Binary
from datetime import datetime
import urllib
upd = """
<xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate">
<xupdate:append select="doc('/db/pycoon-status')/data">
%(data)s
</xupdate:append>
</xupda... | pascalin/pycoon | test/memory_poll.py | Python | gpl-2.0 | 662 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP
#
# 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 limi... | danielreed/python-hpOneView | hpOneView/resources/servers/id_pools_vwwn_ranges.py | Python | mit | 2,209 |
phone = {"a": "2", "b": "2", "c": "2", "d": "3", "e": "3", "f" : "3", "g": "4", "h": "4", "i": "4", "j": "5", "k": "5", "l": "5", "m": "6", "n": "6", "o": "6", "p": "7", "q": "7","r": "7", "s": "7", "t": "8", "u": "8", "v": "8", "w": "9", "x": "9", "y": "9", "z": "9"}
pstrng = str(input("Enter Alphanumeric\n"))
... | ismk/Python-Examples | 04.py | Python | mit | 584 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Address',
fields=[
... | chris48s/UK-Polling-Stations | polling_stations/apps/uk_geo_utils/migrations/0001_initial.py | Python | bsd-3-clause | 2,882 |
from base import *
DIR = "post1"
class Test (TestBase):
def __init__ (self):
TestBase.__init__ (self, __file__)
self.name = "Post request without length"
self.request = "POST /%s/test.php HTTP/1.0\r\n" % (DIR)
self.expected_error = 411
def Prepare (self, www):... | lmcro/webserver | qa/029-Post+Without-length.py | Python | gpl-2.0 | 425 |
#
# Copyright (C) 2012 Mathias Weber <mathew.weber@gmail.com>
# 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,
# t... | mweb/python_template_project | test/testPackages/testPackages.py | Python | bsd-3-clause | 1,848 |
from .crypto_orig import *
if os.getenv('MMGEN_TEST_SUITE_DETERMINISTIC'):
get_random_orig = get_random
add_user_random_orig = add_user_random
import sys
from hashlib import sha256
fake_rand_h = sha256('.'.join(sys.argv).encode())
def fake_urandom(n):
def gen(rounds):
for i in range(rounds):
fake_ra... | mmgen/mmgen | test/overlay/fakemods/crypto.py | Python | gpl-3.0 | 596 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_connectivity_getconnectionendpointdetails_input import TapiConnectivityGetconnectionendpoi... | karthik-sethuraman/ONFOpenTransport | RI/flask_server/tapi_server/models/inline_object13.py | Python | apache-2.0 | 1,864 |
r'''
Copyright 2016 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 by applicable law or agreed to i... | mkenne11/nogotofail-pii | nogotofail/mitm/report/process_logs.py | Python | apache-2.0 | 15,577 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
import socket
import pycurl
import unittest
try:
import urllib.parse as urllib_parse
except ImportError:
import urllib as urllib_parse
from . import app
from . import runwsgi
from . import util
setup_module, teardown_module = runwsgi.app_runner... | p/pycurl-archived | tests/socket_open_test.py | Python | lgpl-2.1 | 1,183 |
from __future__ import print_function
from acq4.pyqtgraph.canvas import Canvas as OrigCanvas
from . import items
class Canvas(OrigCanvas):
"""Extends pyqtgraph's canvas to add integration with datamanager and
an item type registration system."""
def addFile(self, fh, **opts):
## automatically ... | pbmanis/acq4 | acq4/util/Canvas/Canvas.py | Python | mit | 1,814 |
"""
Settings to run LMS in devstack using optimized static assets.
This configuration changes LMS to use the optimized static assets generated for testing,
rather than picking up the files directly from the source tree.
The following Paver command can be used to run LMS in optimized mode:
paver devstack lms --opti... | eduNEXT/edx-platform | lms/envs/devstack_optimized.py | Python | agpl-3.0 | 1,597 |
__version__ = '1.0.0'
__author__ = 'kevin@idempotent.ca'
| kevinjqiu/ctx | ctx/version.py | Python | mit | 57 |
import sys
import os
import subprocess
import xml.sax
import tempfile
import shutil
from base64 import encodestring
sys.path.append("/usr/share/rhn/")
from up2date_client import up2dateLog
from up2date_client import rhnserver
from up2date_client import up2dateAuth
from up2date_client import up2dateErrors
from rhn.i18n... | jhutar/spacewalk | client/rhel/spacewalk-oscap/scap.py | Python | gpl-2.0 | 6,416 |
from sys import argv
def generatePrimes(words):
limit = len(words) ** 2
notPrimes = []
for a in range(3, limit):
for b in range(a * 2, limit, a):
notPrimes += [b]
notPrimes = set(notPrimes)
i = 3
x = []
while len(x) < len(words):
if not i in notPrimes: x += [(wo... | LandonPowell/FizzBuzzi | FizzGen.py | Python | cc0-1.0 | 841 |
#!/usr/bin/env python
#coding=utf8
#
#检测注册页面用户身份证输入是否合法
import pycurl
import StringIO
from BeautifulSoup import BeautifulSoup
# from urllib import urlencode
def check_id_card(idcard_num,cookie_file,proxy):
spider_url = "http://www.bjguahao.gov.cn/comm/getajaxuser.php?sfzhm="+idcard_num
#cookie_file = './Cookie/cookie... | lichenhui/guahao | guahao_beijing/reg_check_idcard_num.py | Python | apache-2.0 | 1,486 |
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | h0x91b/redis-v8 | redis/deps/v8/tools/testrunner/local/testsuite.py | Python | mit | 6,625 |
from __future__ import division, print_function
import os
import sys
import pickle
import copy
import warnings
from os.path import join
from numpy.distutils import log
from distutils.dep_util import newer
from distutils.sysconfig import get_config_var
from numpy._build_utils.apple_accelerate import (
uses_accelera... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/numpy/core/setup.py | Python | mit | 41,471 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>, and others
# Copyright: (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_funct... | ansible/ansible | lib/ansible/modules/command.py | Python | gpl-3.0 | 15,294 |
"""
NOTE:
Avoid using this module on your own or in plugins, this was originally made for 0.9 -> 1.0 transition.
You can safely use task.simple_persistence and manager.persist, if we implement something better we
can replace underlying mechanism in single point (and provide transparent switch).
"""
from __future__ im... | LynxyssCZ/Flexget | flexget/utils/simple_persistence.py | Python | mit | 8,034 |
import warnings
import base64
import ipywidgets as widgets
from traitlets import (
Float,
Dict,
List,
Bool,
observe,
Unicode,
)
@widgets.register
class SankeyWidget(widgets.DOMWidget):
"""Sankey widget"""
_view_name = Unicode('SankeyView').tag(sync=True)
_model_name = Unicode('San... | ricklupton/ipysankeywidget | ipysankeywidget/sankey_widget.py | Python | mit | 6,658 |
# Copyright (C) 2014 Midokura SARL.
# 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 requir... | midokura/python-neutron-plugin-midonet | midonet/neutron/db/__init__.py | Python | apache-2.0 | 633 |
import os
import time
import umsgpack
import datetime
import threading
import btctxstore
import storjnode
from storjnode.util import safe_log_var
from storjnode.common import THREAD_SLEEP
from kademlia.network import Server as KademliaServer
from kademlia.storage import ForgetfulStorage
from kademlia.node import Node a... | Storj/storjnode | storjnode/network/server.py | Python | mit | 9,958 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import six
from django.utils.transl... | lawzou/shoop | shoop/admin/modules/methods/views/edit_detail.py | Python | agpl-3.0 | 1,471 |
import logging
import os
import time
from definitions.Constants import *
from server.modules.Configuration import config, initialize
from server.modules.Firewall.Firewall import Firewall
LOG = logging.getLogger(__name__)
def benchmark(ipv4 = True, ipv6 = False, tcp = True, udp = False, csvOutput = '/tmp'):
init... | tumi8/sKnock | server/benchmarks/ap_firewall.py | Python | gpl-3.0 | 8,763 |
blah=1 | siosio/intellij-community | python/testData/inspections/PyUnresolvedReferencesInspection3K/NamespacePackageInMultipleRoots/root2/src/nspackage/m2.py | Python | apache-2.0 | 6 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# RadioReference.com
#------------------------------------------------------------
# Based on code from pelisalacarta
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
#--------------------------------------------------------... | odicraig/kodi2odi | addons/plugin.video.earthcam/xbmctools.py | Python | gpl-3.0 | 46,166 |
from django.conf.urls.defaults import *
urlpatterns = patterns('rcs.wiki.views',
url(r'^((?:[A-Z]+[a-z]+){2,})/$', 'page', {}, name="wiki_page"),
url(r'^((?:[A-Z]+[a-z]+){2,})/edit/$', 'edit', {}, name="wiki_edit"),
url(r'^((?:[A-Z]+[a-z]+){2,})/attachments/$', 'attachments', {}, name="wiki_attachments"),
... | sedden/pkg-python-django-rcsfield | rcs/wiki/urls.py | Python | bsd-3-clause | 657 |
from gettext import gettext as _
from pulp.client.commands.schedule import (
DeleteScheduleCommand, ListScheduleCommand, CreateScheduleCommand,
UpdateScheduleCommand, NextRunCommand, ScheduleStrategy)
from pulp.client.commands.options import OPTION_REPO_ID
from pulp_puppet.common.constants import IMPORTER_ID
... | ammaritiz/pulp_puppet | pulp_puppet_extensions_admin/pulp_puppet/extensions/admin/repo/sync_schedules.py | Python | gpl-2.0 | 3,790 |
#!/usr/bin/env python3
##
## /svn-src/printer/src/cxi/utils.py
##
import sys
import socket
import re
from .cxifont import *
DEBUG = 0
XSTART = 10
YSTART = 10
SPACE = " "
EOL = "\r\n"
VAR = "VARIABLE"
WRITE = "WRITE"
END = "END"
QQ = "?"
### key for returning structure from making labels ###
CXI_RET='Return value'... | informatics-isi-edu/microscopy | printer/src/cxi/utils.py | Python | apache-2.0 | 26,513 |
""":mod `rmon.commons` --- commons blueprint
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
| gnkr8/rmon | rmon/commons/__init__.py | Python | mit | 95 |
# urlpath.py
# 0.1.0
# 2005/08/20
# Functions that handle url paths.
# Part of Pythonutils
# http://www.voidspace.org.uk/python/pythonutils.html
# Copyright Michael Foord, 2004 & 2005.
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# For information about bugfixe... | cligu/gitdox | modules/urlpath.py | Python | apache-2.0 | 7,816 |
class Solution(object):
def getPermutation(self, n, k):
"""
:type n: int
:type k: int
:rtype: str
"""
if n == 1:
return '1'
base = 1
k -= 1
factorial = [1]
for i in range(2, n):
factorial.append(factorial[-1]*i)
... | tedye/leetcode | Python/leetcode.060.permutation-sequence.py | Python | mit | 579 |
"""uVoyeur Application Bus"""
class PublishFailures(Exception):
delimiter = '\n'
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
self._exceptions = list()
def capture_exception(self):
self._exceptions.append(sys.exc_info()[1])
def get_instance... | egustafson/uvoyeur | uvoyeur/daemon/bus.py | Python | apache-2.0 | 2,122 |
# Write list functions that carry out the following tasks for a list of integers. For each
# function, provide a test program.
# a. Swap the first and last elements in the list.
# FUNCTIONS
def swapFirst_and_Last(list):
# bubble sort
temp = list[0]
list[0] = list[-1]
list[-1] = temp
return te... | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter6-Lists/P6.4A.py | Python | mit | 537 |
#
# Copyright (C) 2017-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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... | KaiSzuttor/espresso | testsuite/python/force_cap.py | Python | gpl-3.0 | 2,014 |
# -*- test-case-name: twisted.conch.test.test_insults -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
from StringIO import StringIO
from twisted.trial import unittest
from twisted.test.proto_helpers import StringTransport
from twisted.conch.insults.insults import ServerProtocol,... | kenorb-contrib/BitTorrent | twisted/conch/test/test_insults.py | Python | gpl-3.0 | 13,197 |
# rasPyCNCController
# Copyright 2016 Francesco Santini <francesco.santini@gmail.com>
#
# This file is part of rasPyCNCController.
#
# rasPyCNCController 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 ... | fsantini/rasPyCNCController | pyJoy/JoyStatus.py | Python | gpl-3.0 | 2,969 |
import datetime
from lib.slack import SlackResponse, SlackPreformattedMessage
from db.post import Post, PostUser, PostValue
from prettytable import PrettyTable, ALL, NONE
MONTHS=["january", "february", "march", "april", "may", "june",
"july", "august", "september", "october", "november", "december"]
POSTS_PER... | bobderrico80/ValueBot | value_bot.py | Python | mit | 9,124 |
# Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
import enum
from typing import NamedTuple, Union
from ezdxf.math import Vec3
__all__ = [
"Command",
"AnyCurve",
"PathElement",
"LineTo",
"Curve3To",
"Curve4To",
"MoveTo",
]
@enum.unique
class Command(enum.IntEnum):
LI... | mozman/ezdxf | src/ezdxf/path/commands.py | Python | mit | 1,168 |
"""GraphLasso: sparse inverse covariance estimation with an l1-penalized
estimator.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
# Copyright: INRIA
import warnings
import operator
import sys
import time
import numpy as np
from scipy import linalg
from .empirical_covariance_ im... | depet/scikit-learn | sklearn/covariance/graph_lasso_.py | Python | bsd-3-clause | 21,244 |
# coding: utf-8
from unittest import TestCase
from path import path
from scrapy.http import Request, HtmlResponse
from crawler.spiders.spider import EpocaCosmeticosSpider
BASE_URL = 'http://example.com'
def load_file(file_path):
return path('tests/' + file_path).bytes()
def scrapy_response(file_path):
reque... | eduardo-matos/simple-crawler | tests/test_epoca_cosmeticos.py | Python | unlicense | 1,784 |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^... | devrishik/mapquest_test | everetail/everetail/urls.py | Python | mit | 1,067 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
# Make sure the project root is on the path
from path import path
PROJECT_ROOT = path(__file__).abspath().realpath().dirname().parent
sys.path.append(PROJECT_ROOT)
# Load the .env file
sys.path.append(PROJECT_ROOT / 'setup'... | nanchenchen/script-analysis | pyanalysis/manage.py | Python | mit | 633 |
from ctypes import *
from vcx.common import do_call, do_call_sync, create_cb
import json
import logging
class Wallet:
@staticmethod
async def close_search(handle: int):
logger = logging.getLogger(__name__)
if not hasattr(Wallet.close_search, "cb"):
logger.debug("vcx_wallet_close... | peacekeeper/indy-sdk | vcx/wrappers/python3/vcx/api/wallet.py | Python | apache-2.0 | 21,237 |
#!/usr/bin/python
AGO_SCHEDULER_VERSION = '0.0.1'
############################################
"""
Basic class for device and device group schedule
"""
__author__ = "Joakim Lindbom"
__copyright__ = "Copyright 2017, Joakim Lindbom"
__date__ = "2017-01-27"
__credits__ = ["Joakim Lindbom", "The ago control ... | JoakimLindbom/ago | scheduler/scheduler.py | Python | gpl-3.0 | 7,085 |
# -*- coding: utf-8 -*-
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from builtins import round
import gdb
import re
import zlib
import sys
from datetime import timedelta
if sys.version_info.... | ptesarik/crash-python | crash/cache/syscache.py | Python | gpl-2.0 | 6,029 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''- See more at: http://magmax.org/2013/09/30/python-avanzado.html#sthash.xsWbcEYG.dpuf
Atributos bajo demanda En python todo funciona como si fuera una tabla Hash o, en nomenclatura más pythónica, un diccionario. Existe un método mágico llamado __dict__, que es un atributo... | lmokto/magicmethods | __dict__/dict1.py | Python | mit | 943 |
"""
Extensible validation for Python dictionaries.
This module implements Cerberus Validator class
:copyright: 2012-2015 by Nicola Iarocci.
:license: ISC, see LICENSE for more details.
Full documentation is available at http://python-cerberus.org
"""
from collections import Callable, Hashable, It... | calve/cerberus | cerberus/cerberus.py | Python | isc | 45,426 |
from instrumental import list_instruments
def test_list_instruments():
list_instruments()
def test_import_all():
import instrumental
for attr in dir(instrumental):
try:
getattr(instrumental, attr)
except ImportError:
pass # Ignore dependencies on mat... | mabuchilab/Instrumental | tests/test_main.py | Python | gpl-3.0 | 342 |
#!/usr/bin/env python
#
# Copyright 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import math
import sys
import numpy
try:
import scipy.linalg
except ImportError:
print("Error: Program requires scipy (see: www.scipy.org).")
sys.e... | dl1ksv/gnuradio | gr-trellis/python/trellis/fsm_utils.py | Python | gpl-3.0 | 6,274 |
from typing import Any, Union
from flasgger import swag_from
from flask import Response, g, url_for
from flask_restful import Resource, marshal
from openatlas.api.v02.resources.parser import default
from openatlas.api.v02.resources.resolve_endpoints import download
from openatlas.api.v02.templates.nodes_overview impo... | craws/OpenAtlas | openatlas/api/v02/endpoints/node/node_overview.py | Python | gpl-2.0 | 1,820 |
from __future__ import unicode_literals
from operator import attrgetter
from django import VERSION
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.db import models, router
from django.db.models.fields import Field
from django.db.models.fields.related import (add... | doselect/django-taggit | taggit/managers.py | Python | bsd-3-clause | 20,713 |
"""
Author: Ang Ming Liang
You need to download celeba dataset from kaggle.
First make sure you have kaggle.json,
as explained at https://github.com/Kaggle/kaggle-api#api-credentials.
then run the following commands in a cell or terminal
```
mkdir /root/.kaggle
cp kaggle.json /root/.kaggle/kaggle.json
chmod 600 /root/... | probml/pyprobml | scripts/vae_conv_celeba_flax_main.py | Python | mit | 1,614 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding M2M table for field badges on 'UserProfile'
m2m_table_name = db.shorten_name(u'storybase_user_userp... | denverfoundation/storybase | apps/storybase_user/migrations/0020_auto__add_m2m_badges.py | Python | mit | 27,416 |
# sudoku_solver/views.py
# Core Django Library Imports
from django.conf.urls import url, patterns
# App Specific Imports
from solve import views as solver_views
urlpatterns = patterns(
'solve.views',
url(r'^api/v1/input/', solver_views.PostSudokuInput.as_view(),
name='input-sudoku-api'),
)
| d3prof3t/django_sudoku_solver | sudoku_solver/api.py | Python | bsd-3-clause | 310 |
import unittest
import asq
from random import seed
class TestNode(unittest.TestCase):
def test_init_method(self):
Q = asq.Simulation(asq.load_parameters('tests/datafortesting/logs_test_for_simulation/'))
N = asq.Node(1, Q)
self.assertEqual(N.mu, [['Exponential', 7.0], ['Exponential', 7.0],... | Lieke19/ASQ | asq/tests/test_node.py | Python | mit | 3,643 |
"""
Django settings for pharmrep project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | boyombo/pharmrep | pharmrep/pharmrep/settings.py | Python | mit | 3,819 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Openstack, LLC
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 ... | zestrada/horizon-cs498cc | openstack_dashboard/dashboards/admin/instances/views.py | Python | apache-2.0 | 3,976 |
import ctypes
from StringIO import StringIO
import re
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
def get_setting(name, default=None, strict=False):
if strict and not hasattr(settings, name):
raise ImproperlyConf... | alexsilva/django-ldap-sync | ldap_sync/utils.py | Python | bsd-3-clause | 1,686 |
#!/usr/bin/env python
from __future__ import print_function, division, absolute_import
import io, os.path, sys
if len (sys.argv) != 4:
print ("usage: ./gen-arabic-table.py ArabicShaping.txt UnicodeData.txt Blocks.txt", file=sys.stderr)
sys.exit (1)
files = [io.open (x, encoding='utf-8') for x in sys.argv[1:]]
he... | live-clones/luatex | source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-table.py | Python | gpl-2.0 | 6,824 |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | HybridF5/jacket | jacket/db/storage/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py | Python | apache-2.0 | 2,621 |
"""
WSGI config for Introduction_mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("... | hayashizakitakaaki/Introduction_mysite | Introduction_mysite/wsgi.py | Python | mit | 415 |
""" Tests paginator methods """
from collections import namedtuple
import ddt
from mock import Mock, MagicMock
from unittest import TestCase
from django.http import Http404
from django.test import RequestFactory
from rest_framework import serializers
from openedx.core.lib.api.paginators import NamespacedPageNumberPa... | franosincic/edx-platform | openedx/core/lib/api/tests/test_paginators.py | Python | agpl-3.0 | 6,444 |
import mock
from pantsmud.driver import hook
from spacegame.core import hook_types
from spacegame.universe.star_system import StarSystem
from spacegame.universe.universe import Universe
from tests.unit.util import UnitTestCase
class StarSystemUnitTestCase(UnitTestCase):
def setUp(self):
UnitTestCase.setUp... | ecdavis/spacegame | tests/unit/test_star_system.py | Python | apache-2.0 | 3,976 |
class Tree:
def __init__(self, *nodes):
self.nodes = list(nodes)
def add_node(self, node):
self.nodes.append(node)
def get_node_from_history(self, history):
current_node = self
for k in history:
for n in current_node.nodes:
if k == n.data:
... | fp12/yahtr | yahtr/utils/tree.py | Python | mit | 1,084 |
#!/usr/bin/env python
from __future__ import absolute_import
import click
import pandas
from nba_py import player as nbaplayer
from draftpy.strategies.last_n_games import LastNGamesStrategy
from draftpy.strategies.vs_team import VsTeamStrategy
import draftpy.galineup
from draftpy.galineup import *
strat2class = {
... | spudfkc/draftpy | draftpy/cli.py | Python | gpl-3.0 | 4,563 |
import json
from datetime import date
from django import forms
from django.contrib.auth.decorators import permission_required, login_required
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import PermissionDenied
from django.urls import reverse_lazy
from django.db.models imp... | gitsimon/tq_website | payment/views.py | Python | gpl-2.0 | 18,612 |
#
# 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... | airbnb/airflow | tests/cli/commands/test_pool_command.py | Python | apache-2.0 | 4,741 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Envivo'
db.create_table(u'envivo_envivo', (
(... | CARocha/sitioreddes | envivo/migrations/0001_initial.py | Python | mit | 1,272 |
# coding=utf-8
from __future__ import unicode_literals
import six
from .base import BasePipe
from ...conf import settings
from ...backends import cache
class CachePipe(BasePipe):
def get_request(self, request):
response = {}
# Only get nodes from cache without specified version
uris = t... | 5monkeys/content-io | cio/pipeline/pipes/cache.py | Python | bsd-3-clause | 1,611 |
SALT_API = {"url": "",
"user": "",
"password": ""
}
Cobbler_API = {"url": "",
"user": "",
"password": ""
}
# salt result
RETURNS_MYSQL = {"host": "localhost",
"port": 63306,
"database": "salt",
"user":... | binbin91/oms | oms/settings_local.py | Python | gpl-2.0 | 819 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006, 2008 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# 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... | arunkgupta/gramps | gramps/plugins/export/exportftree.py | Python | gpl-2.0 | 6,625 |
# Copyright 2018 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... | drpngx/tensorflow | tensorflow/contrib/lite/python/lite_test.py | Python | apache-2.0 | 36,815 |
# coding=utf-8
"""Module for handling workflow definition objects.
Intended for registering a new workflow type with the Configuration database.
"""
import ast
import json
from os.path import dirname, join
import jsonschema
from .. import ConfigDb
DB = ConfigDb()
def add(workflow_definition: dict, templates_root:... | SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py | Python | bsd-3-clause | 4,759 |
import pytest
from django.utils import timezone
from api.preprint_providers.serializers import DeprecatedPreprintProviderSerializer
from api.preprints.serializers import PreprintSerializer
from osf_tests.factories import (
PreprintProviderFactory,
PreprintFactory,
)
from tests.utils import make_drf_request_wit... | pattisdr/osf.io | api_tests/providers/preprints/serializers/test_serializers.py | Python | apache-2.0 | 5,247 |
shopping_list = list()
print(" What should we pick up at the store? ")
print(" Enter 'DONE' to stop adding items. ")
while True:
new_item = input(" > ")
if new_item == 'DONE':
break
shopping_list.append(new_item)
print(" Added! List has {} items ".format(len(shopping_list)))
continu... | empire5790/Treehouse | shopping_list.py | Python | mit | 412 |
# TODO When raising an exception pass a lambda function, the function being the module/path/name thing
ERROR = {'default': "Unknown engine error ({0})",
400: "Bad request sent to search API ({0})",
401: "Incorrect API Key ({0})",
403: "Correct API but request refused ({0})",
404: "B... | leifos/ifind | ifind/search/exceptions.py | Python | mit | 2,524 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2018 OSGeo
#
# 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 ... | ppasq/geonode | geonode/base/management/commands/restore.py | Python | gpl-3.0 | 21,567 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.