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 |
|---|---|---|---|---|---|
# -*- encoding: utf-8 -*-
#
# 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, so... | gnocchixyz/gnocchi | gnocchi/opts.py | Python | apache-2.0 | 10,058 |
"""Dirac notation for states."""
from sympy import Expr, Symbol, Function, integrate, Expr
from sympy import Lambda, oo, conjugate, Tuple, sqrt, cacheit
from sympy.printing.pretty.stringpict import prettyForm
from sympy.physics.quantum.operator import Operator
from sympy.physics.quantum.qexpr import (
QExpr, dis... | Cuuuurzel/KiPyCalc | sympy_old/physics/quantum/state.py | Python | mit | 26,583 |
#
# 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 ... | treasure-data/presto | presto-docs/src/main/sphinx/conf.py | Python | apache-2.0 | 2,763 |
from django.db import models
class Source(models.Model):
'''
This is a source of videos. It can be anything with a url that links to a webpage that has videos.
Currently the system can handle only two types on Content sources; Playlists and Channels
'''
PLAYLIST = 0
CHANNEL = 1
SOURCE_TYPE... | zee93/yt_lab | yt_lab/content/models.py | Python | mit | 1,144 |
# -*- coding: utf-8 -*-
import os
import sys
class OpenCloseController(object):
def __init__(self, activity, pending_tasks, timer_tasks):
super(OpenCloseController, self).__init__()
self.activity = activity
self.pending_tasks = pending_tasks
self.timer_tasks = timer_tasks
... | ym-kaoru/splash_screen_controller_demo | src/open_close_controller.py | Python | apache-2.0 | 14,660 |
# 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 +
from __future__ import (absolute_import, divi... | mganeva/mantid | Framework/PythonInterface/plugins/algorithms/DeltaPDF3D.py | Python | gpl-3.0 | 19,144 |
# Copyright 2017 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... | ZhangXinNan/tensorflow | tensorflow/python/util/tf_inspect.py | Python | apache-2.0 | 11,870 |
"""
Clicker Hero Bot
Copyright (C) 2015 Joel Whitcomb
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | Zanthras/heroclicker | clicker.py | Python | gpl-3.0 | 19,266 |
from functools import wraps
from google.appengine.api import users
from flask import redirect, request
def login_required(func):
@wraps(func)
def decorated_view(*args, **kwargs):
if not users.get_current_user():
return redirect(users.create_login_url(request.url))
return func(*args,... | mmjbot/muslogger | decorators.py | Python | apache-2.0 | 356 |
from __future__ import print_function
import random
import time
import Pyro4
@Pyro4.expose
class StockMarket(object):
def __init__(self, marketname, symbols):
self._name = marketname
self._symbols = symbols
def quotes(self):
while True:
symbol = random.choice(self.symbols)... | irmen/Pyro4 | examples/stockquotes/phase2/stockmarket.py | Python | mit | 1,177 |
import os
import sys
# import urllib3
import json
from urllib import request
from bs4 import BeautifulSoup
####################################################################
# A command line util to scrape Ben Yehuda content pages into JSON #
####################################################################
def... | tomirendo/BenYehuda | scraper/ido_scraper.py | Python | cc0-1.0 | 2,568 |
#!/bin/env python
#-*-coding:utf-8-*-
import string
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
import smtplib
from email.mime.text import MIMEText
from email.message import Message
from email.header import Header
import functions as func
mail_host = func.get_option('smtp_host')
mail_... | G8bao7/camelbell-server | include/sendmail.py | Python | gpl-3.0 | 1,335 |
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Review(models.Model):
source = models.CharField(max_length=100)
content_type = mo... | twz915/django | tests/multiple_database/models.py | Python | bsd-3-clause | 2,294 |
# deviceaction.py
# Device modification action classes for anaconda's storage configuration
# module.
#
# Copyright (C) 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License... | kalev/anaconda | pyanaconda/storage/deviceaction.py | Python | gpl-2.0 | 20,775 |
from datetime import datetime
from calendar import day_name
def most_frequent_days(year):
"""
List of most frequent days of the week in the given year
"""
firstweek = set(range(datetime(year, 1, 1).weekday(), 7)) # weekday 0..6
lastweek = set(range(datetime(year, 12, 31).isoweekda... | fbreversg/checkio | Dropbox/the-most-frequent-weekdays.py | Python | mit | 851 |
# -*- coding: utf-8 -*-
"""The parser and parser plugin presets."""
from __future__ import unicode_literals
import yaml
from plaso.containers import artifacts
from plaso.lib import errors
class ParserPreset(object):
"""Parser and parser plugin preset.
Attributes:
name (str): name of the preset.
operat... | rgayon/plaso | plaso/parsers/presets.py | Python | apache-2.0 | 7,245 |
def extractSelkinNovel(item):
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
| fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractSelkinNovel.py | Python | bsd-3-clause | 201 |
"""Assign Params to Attributes by Joel Hedlund <joel.hedlund at gmail.com>.
Changed:Fabio Zadrozny (binded to Ctrl+1 too)
"""
__version__ = "1.0.1"
__copyright__ = '''Available under the same conditions as PyDev.
See PyDev license for details.
http://pydev.sourceforge.net
'''
#====================================... | fabioz/Pydev | plugins/org.python.pydev.jython/jysrc/assign_params_to_attributes_action.py | Python | epl-1.0 | 8,539 |
from django.apps import AppConfig
class DeploymentsConfig(AppConfig):
name = 'deployments'
| jpulec/purgatory | src/deployments/apps.py | Python | mit | 97 |
# -*- python -*-
# Mark Charney
#BEGIN_LEGAL
#
#Copyright (c) 2016 Intel 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
#
... | intelxed/mbuild | mbuild/scanner.py | Python | apache-2.0 | 3,459 |
import os
from epumgmt.main import get_class_by_keyword, get_all_configs
def get_default_config():
try:
prefix = os.environ['EPUMGMT_HOME']
except KeyError:
prefix = os.path.expanduser("~/.epumgmt")
conf_file=os.path.join(prefix, "etc/main.conf")
return conf_file
def get_default_ac():
... | nimbusproject/epumgmt | src/python/epumgmt/api/__init__.py | Python | apache-2.0 | 4,049 |
# -*- coding: utf-8 -*-
""" The password_required decorator for Django views """
from functools import update_wrapper, wraps
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.decorators import available_attrs
f... | modulexcite/django-password-required | password_required/decorators.py | Python | bsd-3-clause | 1,027 |
# Script to add the min and max mz values to feature objects
# takes as input the an experiment name and a dictionary of features and their ranges
import os
import pickle
import numpy as np
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")
import django
django.setup()
from basicviz.mo... | sdrogers/ms2ldaviz | ms2ldaviz/add_range_to_features.py | Python | mit | 902 |
# -*- encoding: utf-8 -*-
# Variables Flask
import os
HOST = '0.0.0.0'
DEBUB = 'True'
BCRYPT_LEVEL = 12
PORT = 5000
SECRET_KEY = os.environ['SERIAUTH_FLASK_SECRET']
# Logging
LOG_PATH = 'logs/error.log'
LOG_LEVEL = 'DEBUG'
# Variables SQLALCHEMY
SQLALCHEMY_ECHO = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
# Variabl... | seribits/seriauth | config/development.py | Python | gpl-3.0 | 798 |
import unittest
import sys
# make sure hirlite isn't imported from source
sys.path = sys.path[1:]
def tests():
from test import rlite, persistent
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(rlite.RliteTest))
suite.addTest(unittest.makeSuite(persistent.PersistentTest))
try:
... | seppo0010/rlite-py | test/__init__.py | Python | bsd-2-clause | 539 |
from django.conf.urls import patterns, url
from .views import MediaLibraryAPIView, MediaLibraryItemView, AddShelfRelationAPIView
urlpatterns = patterns('',
url(r'^(?P<type>(audio|video|image))/$', MediaLibraryAPIView.as_view(), name='medialibrary'),
url(r'^(?P<pk>\d+)/$', MediaLibraryItemView.as_view(), name='... | pulilab/django-medialibrary | medialibrary/urls.py | Python | bsd-3-clause | 450 |
#!/usr/bin/env python
#
# Copyright (c) 2016 Washington State Department of Transportation
#
# 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... | WSDOT/social-analytics | server/python/get_mentions.py | Python | gpl-3.0 | 3,470 |
import ssm_parameter_name
def test_arn_to_name():
region = "eu-central-1"
account = "111111111114"
test_set = {
"issue-25": "issue-25",
"/issue-25": "issue-25",
"demo/issue-25": "/demo/issue-25",
"/demo/issue-25": "/demo/issue-25",
}
for name, expect in test_set.ite... | binxio/cfn-secret-provider | tests/test_ssm_parameter_name.py | Python | apache-2.0 | 2,415 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ProcessingPlugin.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | camptocamp/QGIS | python/plugins/processing/ProcessingPlugin.py | Python | gpl-2.0 | 5,606 |
"""
Path operations common to more than one OS
Do not use directly. The OS specific modules import the appropriate
functions from this module themselves.
"""
import os
import stat
__all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime',
'getsize', 'isdir', 'isfile']
# Does a path exist?
#... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/genericpath.py | Python | gpl-2.0 | 3,015 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 (Original Author)
# Domsense s.r.l. (<http://www.domsense.com>)
# Copyright (C) 2014 (OpenERP version 7&8 adaptation)
# Matmoz d.o.o. ... | sysadminmatmoz/pmis | project_document_page/__manifest__.py | Python | agpl-3.0 | 1,720 |
from browser import doc
from browser.html import *
trans_menu = {
'menu_console':{'en':'Console','es':'Consola','fr':'Console', 'pt':'Console'},
'menu_editor':{'en':'Editor','es':'Editor','fr':'Editeur', 'pt':'Editor'},
'menu_gallery':{'en':'Gallery','es':'Galería','fr':'Galerie', 'pt':'Galeria'},
'me... | nvoron23/brython | site/doc/pt/header.py | Python | bsd-3-clause | 2,361 |
# 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... | kobejean/tensorflow | tensorflow/python/ops/linalg/linear_operator_zeros.py | Python | apache-2.0 | 18,051 |
from unittest import TestCase
import mock
import pytest
from cnavbot import settings
from cnavbot.services import pi2go
class TestMotors(TestCase):
def setUp(self):
self.motors = pi2go.Motors(driver=mock.Mock())
self.motors.keep_running = mock.Mock()
self.steps = 5
def test_validat... | konradko/cnav-bot | cnavbot/tests/bot/test_pi2go.py | Python | mit | 4,426 |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcredit Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
fr... | dragosbdi/bitcredit-2.0 | qa/rpc-tests/invalidblockrequest.py | Python | mit | 4,244 |
"""
taken from
http://www.djangosnippets.org/snippets/377/
"""
import datetime, json
from django.db import models
from django.db.models import signals
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
class JSONField(models.TextField):
"""
JSONField is a generic text... | stanley89/helios-server | helios_auth/jsonfield.py | Python | apache-2.0 | 2,156 |
import time
from datetime import datetime
import re
import sys
import os
import config
def is_numeric(strin):
import decimal
strin = str(strin)
# Decimal allows spaces in input, but we don't
if strin.strip() != strin:
return False
try:
value = decimal.Decimal(strin)
except de... | ivansib/sentinel | lib/misc.py | Python | mit | 969 |
import multiprocessing, time
from _class.Game import Game
from _class.BackgroundImg import *
from _class.task.key_event import *
from _class.task.timer import *
from _class.task.main_loop import *
from _class.task.items_fall import *
from _class.task.recipe import *
from _class.task.score import *
def start_threads(ga... | CackboneML/KebabParty | main.py | Python | mit | 1,432 |
from __future__ import absolute_import, unicode_literals
import re
from .lowlevel import batches
from .queue import delete_queues
from .conf import settings
class ChinupTestMixin(object):
"""
Clear batches record in setUp, and provide assertBatches.
"""
def setUp(self):
super(ChinupTestMixin... | pagepart/chinup | chinup/testing.py | Python | mit | 963 |
from flask import url_for
import json
from test_base import BaseTestCase
from routes import db
from models import BucketListItem, User
class BucketListItemTests(BaseTestCase):
"""This class contains all tests for actions on a bucketlist_item"""
def test_bucket_list_item_creation_suceeds_when_right_info_is_pr... | andela-engmkwalusimbi/checkpoints | tests/test_bucket_lists_item.py | Python | mit | 6,534 |
def countdown(x):
while x >= 0:
print x
x -= 1
countdown(88)
###
def count(x):
if x > 0:
while x >= 0:
print x
x -= 1
else:
while x <= 0:
print x
x += 1
count(4)
count(-9)
###
def countfrom(start, stop):
while start < stop:
... | mekhala1808-cmis/mekhala1808-cmis-cs2 | whileloops.py | Python | cc0-1.0 | 1,001 |
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/gazoo-device | gazoo_device/tests/unit_tests/capability_tests/matter_endpoint_tests/color_temperature_light_test.py | Python | apache-2.0 | 1,417 |
from __future__ import print_function, division
#
import sys,os
quspin_path = os.path.join(os.getcwd(),"../")
sys.path.insert(0,quspin_path)
#
from quspin.operators import hamiltonian # Hamiltonians and operators
from quspin.basis import spinless_fermion_basis_1d # Hilbert space spin basis_1d
from quspin.basis.user imp... | weinbe58/QuSpin | tests/user_basis_spinless_fermion_test.py | Python | bsd-3-clause | 7,031 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# (c) Valik mailto:vasnake@gmail.com
u''' Translit encode functions for rus transliterations mentioned in
wiki: Транслитерация русского алфавита латиницей
dependencies
pip install trans
links
http://habrahabr.ru/post/137089/
Copyright (C) 2013, Val... | vasnake/transbot | translitbot/enc.py | Python | gpl-3.0 | 22,923 |
"""Function to manage skymodels.
"""
from processing_components.skymodel.operations import copy_skymodel, show_skymodel, update_skymodel_from_image, \
update_skymodel_from_gaintables, initialize_skymodel_voronoi, calculate_skymodel_equivalent_image, \
update_skymodel_from_image, expand_skymodel_by_skycomponent... | SKA-ScienceDataProcessor/algorithm-reference-library | wrappers/serial/skymodel/operations.py | Python | apache-2.0 | 322 |
# -*- coding: utf-8 -*-
'''
Pkgutil support for Solaris
'''
# Import python libs
import copy
# Import salt libs
import salt.utils
def __virtual__():
'''
Set the virtual pkg module if the os is Solaris
'''
if __grains__['os'] == 'Solaris':
return 'pkgutil'
return False
def refresh_db():... | victorywang80/Maintenance | saltstack/src/salt/modules/pkgutil.py | Python | apache-2.0 | 9,267 |
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | deepaklukose/grpc | examples/python/interceptors/headers/generic_client_interceptor.py | Python | apache-2.0 | 2,547 |
from rip.schema.base_field import FieldTypes
from rip.schema.string_field import StringField
from rip import url_constructor
class ResourceUriField(StringField):
"""This field is to be used to add a resource
with respect to parent resource.
URI of the resource in context is appended to that of parent.
... | Aplopio/rip | rip/schema/resource_uri_field.py | Python | mit | 1,864 |
"""A light system for platforms which batches all updates."""
import abc
import asyncio
from typing import Tuple, Set, List
from sortedcontainers import SortedSet, SortedList
from mpf.platforms.interfaces.light_platform_interface import LightPlatformInterface
from mpf.core.utility_functions import Util
class Platfor... | missionpinball/mpf | mpf/core/platform_batch_light_system.py | Python | mit | 7,892 |
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
"""
Module wrapper for loading ASDF files.
.. note:: The API for this module is currently unstable
and may change in a future release.
"""
import numpy as np
try:
import asdf # noqa
from asd... | naojsoft/ginga | ginga/util/io/io_asdf.py | Python | bsd-3-clause | 6,228 |
# -*- coding: utf-8 -*-
"""
Example code to call Rosette API to get linked (against Wikipedia) entities from a piece of text.
"""
import argparse
import pprint
from rosette.api import API, DocumentParameters
parser = argparse.ArgumentParser(description="Get linked entities from a piece of text")
parser.add_argument... | JamieMoon/rosette-api | python/target/github/rosette-api/python/target/github/rosette-api/python/examples/entities_linked.py | Python | apache-2.0 | 1,010 |
import sqlite3
from db import get_connection, get_from_datamaster
requirements = []
def build():
with get_connection() as con:
cur = con.cursor()
cur.execute("DROP TABLE IF EXISTS Characters")
cur.execute("CREATE TABLE Characters("
"Id INTEGER PRIMARY KEY AUTOINCREMENT... | jpludens/quartrmastr | db/tables/characters.py | Python | mit | 948 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('experiment', '0004_auto_20150727_1405'),
]
operations = [
migrations.AlterField(
model_name='customerexperiment'... | CentechMTL/TableauDeBord | app/experiment/migrations/0005_auto_20160330_1625.py | Python | gpl-3.0 | 919 |
#!/usr/bin/env python
# vim: sts=4 sw=4 et
"""
XEmbed helper functions to allow correct embeding inside Axis
"""
import gtk
def reparent(window, parent):
""" Forced reparent. When reparenting Gtk applications into Tk
some extra protocol calls are needed.
"""
from Xlib import display
from Xlib.xobj... | ArcEye/machinekit-testing | lib/python/gladevcp/xembed.py | Python | lgpl-2.1 | 2,853 |
#!/usr/bin/env python
from loader import Loader
from postgres import PostgresLoader
| codeforamerica/w-drive-extractor | wextractor/loaders/__init__.py | Python | mit | 84 |
#!/usr/bin/env python
# Copyright (C) 2009,2010 Junta de Andalucia
#
# Authors:
# Roberto Majadas <roberto.majadas at openshine.com>
# Cesar Garcia Tapia <cesar.garcia.tapia at openshine.com>
# Luis de Bethencourt <luibg at openshine.com>
# Pablo Vieytes <pvieytes at openshine.com>
#
# This program is free so... | GNOME/nanny | daemon/src/DansGuardianImporter.py | Python | gpl-2.0 | 11,948 |
# 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 req... | DavidPurcell/murano_temp | murano/common/wsgi.py | Python | apache-2.0 | 38,930 |
#
import numpy as np
import transformation as tran
class Mosaic(object):
"""
Mosaic is a base class that provides functionality to layout a list
of data ndarrays of the same size into an output mosaic. The main
characteristics are:
- Input data and their location in the output mosaic is... | pyrrho314/recipesystem | trunk/gempy/library/mosaic.py | Python | mpl-2.0 | 45,425 |
f"""result: {value:{60}.{16!s:2}{'qwerty'
[2]}}"""
def foo(): pass
f : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.multi.python
""" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.interpolate... | MagicStack/MagicPython | test/fstrings/nested4.py | Python | mit | 3,189 |
import os
import json
import random
import unittest
import numpy as np
import sys
import tempfile
import shutil
from unittest.mock import MagicMock
import ray
from ray import tune
from ray.tune import Trainable
from ray.tune.result import TRAINING_ITERATION
from ray.tune.schedulers import (HyperBandScheduler, AsyncHyp... | robertnishihara/ray | python/ray/tune/tests/test_trial_scheduler.py | Python | apache-2.0 | 74,393 |
##########################################################################
#
# Copyright (c) 2011-2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | chippey/gaffer | python/GafferCortexUI/PresetsOnlyParameterValueWidget.py | Python | bsd-3-clause | 3,961 |
# 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/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pools_operations.py | Python | mit | 46,289 |
from tastypie.serializers import Serializer as DefaultSerializer
import msgpack
class Serializer(DefaultSerializer):
def __init__(self, *args, **kwargs):
super(Serializer, self).__init__(*args, **kwargs)
self.formats.append("msgpack")
self.content_types["msgpack"] = "application/x-msgpac... | stephenmcd/tastypie-msgpack | tastypie_msgpack/__init__.py | Python | bsd-2-clause | 514 |
from __future__ import annotations
from collections.abc import Iterable, Mapping
from contextlib import nullcontext
import os
from pathlib import Path
import re
import tempfile
from types import MappingProxyType
from typing import Any
from markdown_it import MarkdownIt
from markdown_it.renderer import RendererHTML
i... | executablebooks/mdformat | src/mdformat/_util.py | Python | mit | 3,788 |
#Embedded file name: ACEStream\Player\BaseApp.pyo
import os
import sys
import time
import shutil
import urllib
import hashlib
import binascii
import random
import subprocess
import struct
import pickle
import cookielib
from operator import itemgetter
from base64 import b64encode, encodestring
from types import DictType... | alesnav/p2ptv-pi | acestream/ACEStream/Player/BaseApp.py | Python | mit | 137,147 |
import threading
import time
from resources.lib import utils, Logger, TimVisionObjects
import xbmc
class MyPlayer(xbmc.Player):
current_content_id = None
current_item = None
current_time = 0
total_time = 0
start_from = 0
threshold = 0.0
current_video_type = ''
listen = False
playbac... | pinoelefante/plugin.video.timvision | resources/lib/MyPlayer.py | Python | gpl-3.0 | 6,219 |
from django import template
from django.conf import settings
from ccpages.models import Page
register = template.Library()
@register.inclusion_tag('ccpages/_js.html')
def ccpages_js():
return {
'STATIC_URL': settings.STATIC_URL,
}
@register.inclusion_tag('ccpages/_css.html')
def ccpages_css():
re... | designcc/django-ccpages | ccpages/templatetags/ccpages_tags.py | Python | bsd-3-clause | 921 |
def overrides(method):
'''
Initially meant to be used as
class B:
@overrides(A.m1)
def m1(self):
pass
but as we want to be compatible with Jython 2.1 where decorators have an uglier syntax (needing an assign
after the method), it should now be used without being a decor... | mrknow/filmkodi | plugin.video.mrknow/mylib/_pydev_bundle/pydev_override.py | Python | apache-2.0 | 1,314 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as publish... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/telegram/inline/inlinequeryresultcachedsticker.py | Python | mit | 2,748 |
"""
=====================================================================
Django app deployment scripts
Copyright (C) 2016 Stefan Dieterle
e-mail: golgoths@yahoo.fr
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 Softwar... | globz-eu/django_base | base/unit_tests/pending_tests/test_pending.py | Python | gpl-3.0 | 1,109 |
import asyncio
import inspect
import re
import unittest
from unittest.mock import (ANY, call, AsyncMock, patch, MagicMock, Mock,
create_autospec, sentinel, _CallList)
def tearDownModule():
asyncio.set_event_loop_policy(None)
class AsyncClass:
def __init__(self):
pass
... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/unittest/test/testmock/testasync.py | Python | apache-2.0 | 33,689 |
import os, sys
sys.path.insert(0,os.path.join(os.path.dirname(os.path.abspath(__file__)),'lib'))
appstats_CALC_RPC_COSTS = True
def webapp_add_wsgi_middleware(app):
from google.appengine.ext.appstats import recording
#app = recording.appstats_wsgi_middleware(app)
return app
| rcarmo/yaki-gae | appengine_config.py | Python | mit | 283 |
# Author: Roberto Cavada <roboogle@gmail.com>
#
# Copyright (C) 2005-2015 by Roberto Cavada
#
# gtkmvc3 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at yo... | roboogle/gtkmvc3 | gtkmvco/gtkmvc3/model.py | Python | lgpl-2.1 | 34,987 |
from __future__ import unicode_literals
import datetime
from boto.ec2.elb.attributes import (
LbAttributes,
ConnectionSettingAttribute,
ConnectionDrainingAttribute,
AccessLogAttribute,
CrossZoneLoadBalancingAttribute,
)
from boto.ec2.elb.policies import (
Policies,
OtherPolicy,
)
from moto.... | heddle317/moto | moto/elb/models.py | Python | apache-2.0 | 15,471 |
import sqlite3
import random
with sqlite3.connect("newnum.db") as connection:
c = connection.cursor()
c.execute("drop table if exists numbers")
c.execute("create table numbers(num int)")
for i in range(100):
c.execute("insert into numbers values(?)", (random.randint(0, 100), ))
| recto/real_python | helloworld/src/sql/assignment3a.py | Python | mit | 306 |
#!/usr/bin/python
import os, sys
log_file = 'py_ns3_visualizer.log'
# Remove log file
if os.path.exists (log_file):
os.system ('rm %s' % log_file)
if len (sys.argv) == 2 and sys.argv[1] == 'help': #not in [1, 2, 3]:
print 'Usage: runner [<events.log>] [<interval>]'
sys.exit (0)
if len (sys.argv) >= 2:
event... | AliZafar120/NetworkStimulatorSPl3 | rapidnet_visualizer/runner.py | Python | gpl-2.0 | 884 |
#!/usr/bin/python
from distutils.core import setup
from optparse import OptionParser
from glob import glob
from Pyrex.Distutils.extension import Extension
from Pyrex.Distutils import build_ext
parser = OptionParser()
parser.add_option('-b','--build', help='Build directory in which libraries are found. Relative to pro... | indashnet/InDashNet.Open.UN2000 | android/external/harfbuzz_ng/contrib/python/setup.py | Python | apache-2.0 | 1,500 |
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import sys
from int... | UnrememberMe/pants | testprojects/src/python/interpreter_selection/python_3_selection_testing/test_py2.py | Python | apache-2.0 | 554 |
from __future__ import unicode_literals, division, absolute_import
import logging
from urlparse import urljoin
from requests import RequestException
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.plugins.api_trakt import get_session, make_list_slug, get_api_url... | lildadou/Flexget | flexget/plugins/input/trakt_emit.py | Python | mit | 5,821 |
# -*- coding: utf-8 -*-
#/#############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under th... | bakhtout/odoo-educ | addons/openeducat_erp/wizard/exam_seating_arrangement.py | Python | agpl-3.0 | 2,177 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from openid.consumer.consumer import SuccessResponse
from openid.consumer.discover import OpenIDServiceEndpoint
from openid.message import IDENTIFIER_SELECT
from identityprovider.... | miing/mci_migo | identityprovider/tests/test_teams.py | Python | agpl-3.0 | 8,604 |
#!/home/eisandy/greetingslack/greetingslack/bin/python2
import argparse
import code
import sys
import threading
import time
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encoding = getattr(sys.stdin, "encoding"... | EiSandi/greetingslack | greetingslack/bin/wsdump.py | Python | mit | 5,938 |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 11 20:23:01 2014
@author: Brandon
This implements Paul Krugman's babysitting co-op model.
"""
# import logging
import indra.entity as ent
import indra.env as env
import indra.display_methods as disp
import logging
import random
''' These are our possible goals'''
UNKNOW... | gcallah/Indra | indraV1/models/coop.py | Python | gpl-3.0 | 4,658 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import argparse
import datetime
import time
import json
import logging
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
import subprocess
from collections import defaultdict
from speech2text import log_kv, walk_files, get_extens... | pluteski/speech-to-text | tally_audio.py | Python | mit | 12,659 |
#!/usr/bin/env python
"""
Generic python script.
"""
__author__ = "Alex Drlica-Wagner"
import os
import glob
import json
import numpy as np
from obztak import set_survey,get_survey
from obztak.maglites import MaglitesSurvey, MaglitesScheduler, MaglitesFieldArray
from obztak.utils.testing import call, make_options
fr... | kadrlica/obztak | tests/test_maglites.py | Python | mit | 969 |
from django.conf.urls import url
from django.contrib.auth.views import *
from categories import views
urlpatterns = [
url(r'^$', views.view_categories, name="view_categories"),
url(r'^(?P<category_pk>\d+)/',
views.view_category_items,
name="category_items"),
]
| GAngelov5/Sportvendor | sportvendor/sportvendor/categories/urls.py | Python | gpl-2.0 | 287 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | itskewpie/tempest | tempest/api/network/test_routers.py | Python | apache-2.0 | 6,019 |
import os, datetime, math
qtree = '/home/bastiaan/Projects/PhD-Project/Latex/qtree.sty'
def bottomlevel(S):
if not S.isSymbol():
return False
for c in S.children:
if not c.isOnset():
return False
return True
def latexify(S):
latex = ''
if S.symbol == ('on', ):
... | bjvanderweij/pymuco | pymuco/util/latex.py | Python | gpl-2.0 | 4,337 |
# ----------------------------------------------------------------------------
# Copyright 2016 Nervana Systems 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.o... | Jokeren/neon | neon/backends/abstract_backend.py | Python | apache-2.0 | 58,382 |
# -*- coding: utf-8 -*-
# RestAPI
# Resource, , response, throttle
from flask import Blueprint
from .packages.decorator import decorator
from functools import wraps
from flask.views import View
class Resource(object):
def __init__(self, route, *args):
"""
If there are decorator arguments, the... | kennethreitz-archive/flask-rest | flaskext/rest/core.py | Python | isc | 1,513 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cali_water', '0014_watersuppliermonthlyreport_hydrologic_region'),
]
operations = [
migrations.AddField(
model_n... | SCPR/accountability-tracker | cali_water/migrations/0015_watersupplier_hydrologic_region_slug.py | Python | gpl-2.0 | 564 |
# Copyright (c) 2011 Florian Mounier
# Copyright (c) 2012, 2014-2015 Tycho Andersen
# Copyright (c) 2013 Mattias Svala
# Copyright (c) 2013 Craig Barnes
# Copyright (c) 2014 ramnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 Adi Sieker
# Copyright (c) 2014 Chris Wesseling
#
# Permission is hereby granted, free o... | frostidaho/qtile | test/layouts/test_slice.py | Python | mit | 4,757 |
from .base import SimSootExpr
class SimSootExpr_ParamRef(SimSootExpr):
def _execute(self):
paramref = self._translate_value(self.expr)
self.expr = self.state.memory.load(paramref, none_if_missing=True)
| iamahuman/angr | angr/engines/soot/expressions/paramref.py | Python | bsd-2-clause | 225 |
# -*- coding: utf-8; -*-
import sys
import re
from ano.commands.base import Command
class Preprocess(Command):
"""
Preprocess an .ino or .pde sketch file and produce ready-to-compile .cpp source.
Arturo mimics steps that are performed by official Arduino Software to
produce similar result:
... | scottdarch/Arturo | ano/commands/preproc.py | Python | mit | 3,535 |
import argparse
import os
import pdb
import numpy as np
import pylab as pl
import pyfits as pf
import sys
import shutil
import NPK.Fit as FF
import NPK.Bar as Bar
import NPK.Util as Util
import SEDMr.IO as IO
from astropy.table import Table
from scipy.spatial import KDTree
import scipy.signal as SG
from scipy.int... | nickkonidaris/kpy | SEDMr/SubtractBackground.py | Python | gpl-2.0 | 5,273 |
#!/usr/bin/env python
import os
#os.chdir('/home/travis/build/erdc/proteus/air-water-vv/2d/numericalTanks/standingWaves')
import pytest
from proteus.iproteus import *
#import standing_waves_so
#import standing_waves as sw
import numpy as np
import collections as cll
import csv
import math
from proteus.test_utils import... | erdc-cm/air-water-vv | Tests/2nd_set/test_standingWaves.py | Python | mit | 6,574 |
# Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.6.0/Lib/test/test_decimal.py | Python | mit | 211,383 |
from coincrawler.storage import IStorage, IBlockStorageAccess, IPriceStorageAccess
mineableCurrencyColumns = ["height", "timestamp", "txVolume", "txCount", "generatedCoins", "fees", "difficulty"]
nonmineableCurrencyColumns = ["height", "timestamp", "txVolume", "txCount", "fees"]
class PostgresStorage(IStorage):
def... | whateverpal/coinmetrics-tools | coincrawler/storage/postgres.py | Python | mit | 3,897 |
#!/usr/bin/python3
################################################################################
# Copyright 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwa... | ROCmSoftwarePlatform/Tensile | bin/parse_results.py | Python | mit | 8,047 |
import logging
import requests
import os
class Mail(object):
"""
Class for sending emails with and without attachments via mailgun
"""
def __init__(self, mailgunapi=None, mailgunkey=None, to_adr=None, from_adr=None, text=None, subject=None):
"""
Create a Mail object
"""
... | lobnek/pyutil | pyutil/message.py | Python | mit | 3,585 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.