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 |
|---|---|---|---|---|---|
import logging
import os
from twilio.rest import Client
class TwilioClient(object):
def __init__(self):
self.logger = logging.getLogger("botosan.logger")
self.account_sid = os.environ["TWILIO_SID"]
self.account_token = os.environ["TWILIO_TOKEN"]
self.client = Client(self.account_si... | FredLoh/BotoSan | twilio-mnc-mcc-getter.py | Python | mit | 1,280 |
# -*- coding: utf-8 -*-
"""
babel.localtime
~~~~~~~~~~~~~~~
Babel specific fork of tzlocal to determine the local timezone
of the system.
:copyright: (c) 2013 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
import sys
import pytz
import time
from datetime import timedelta,... | SohKai/ChronoLogger | web/flask/lib/python2.7/site-packages/babel/localtime/__init__.py | Python | mit | 1,730 |
# -*- coding: utf-8 -*-
from os.path import join, dirname
import sys
from setuptools import setup, find_packages
VERSION = (0, 1, 0)
__version__ = VERSION
__versionstr__ = '.'.join(map(str, VERSION))
README_FILE = 'README.md'
LICENSE_FILE = 'LICENSE'
f = open(join(dirname(__file__), README_FILE))
long_description =... | dqi2018/python-structure | setup.py | Python | apache-2.0 | 1,121 |
# -*- coding: utf-8 -*-
"""
Installs and configures amqp
"""
import logging
import uuid
import os
from packstack.installer import validators
from packstack.installer import basedefs
from packstack.installer import utils
from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import ... | reelai/packstack | packstack/plugins/amqp_002.py | Python | apache-2.0 | 9,580 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ADM', '0006_auto_20150924_1847'),
]
operations = [
migrations.RemoveField(
model_name='all_course',
... | rajeev001114/Grade-Recording-System | project/ADM/migrations/0007_auto_20150924_1920.py | Python | gpl-3.0 | 760 |
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | phillxnet/rockstor-core | src/rockstor/storageadmin/models/email.py | Python | gpl-3.0 | 1,120 |
import itertools
import json
from urllib.parse import urljoin
from django import template
from django.conf import settings
from django.contrib.admin.utils import quote
from django.contrib.humanize.templatetags.humanize import intcomma
from django.contrib.messages.constants import DEFAULT_TAGS as MESSAGE_TAGS
from dja... | mikedingjan/wagtail | wagtail/admin/templatetags/wagtailadmin_tags.py | Python | bsd-3-clause | 17,059 |
from typing import Callable, List, Optional, Union
from django.contrib import messages
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
class ViewAction:
inline_actions: Optional[List[Union[str, Callable]]] = ['view_action']
def vie... | escaped/django-inline-actions | inline_actions/actions.py | Python | bsd-3-clause | 1,425 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | alexlo03/ansible | lib/ansible/vars/hostvars.py | Python | gpl-3.0 | 4,351 |
import numpy as np
def poisson_Kloc(basis, jacb_det, jacb_inv):
topo = basis.topo
order = basis.order
cub_points, cub_weights = topo.get_quadrature(order+1)
Kloc = np.zeros((basis.n_dofs, basis.n_dofs),
dtype=np.double)
cub_vals = basis.eval_ref(cub_points, d=1)
for i in... | shigh/pyfem | pyfem/poisson.py | Python | gpl-2.0 | 1,119 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'avos.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| helber/avos | avos/avos/urls.py | Python | gpl-3.0 | 295 |
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... | agry/NGECore2 | scripts/mobiles/endor/archaic_jinda_ritualist.py | Python | lgpl-3.0 | 1,756 |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from probfit.pdf import novosibirsk
from probfit.plotting import draw_normed_pdf
bound = (5.22, 5.30)
arg = dict(width=0.005, peak=5.28, tail=0.2)
draw_normed_pdf(novosibirsk, arg=arg, bound=bound, label=str(arg), density=True)
arg = dict(width=0.002, peak=5.2... | iminuit/probfit | doc/pyplots/pdf/novosibirsk.py | Python | mit | 613 |
from pathlib import Path
import json
import pandas as pd
from .version import __version__
_CACHE_ROOT_PATH = Path('pytus-cache')
def get_cache_location():
"""Returns the directory into which caches are currently written to and from."""
return _Cache().cache_location
def set_cache_location(cache_location)... | timtroendle/pytus2000 | pytus2000/cache.py | Python | mit | 3,591 |
# Copyright 2010-2015 MongoDB, 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 writin... | pdxwebdev/yadapy | yada/lib/python2.7/site-packages/bson/tz_util.py | Python | gpl-3.0 | 1,518 |
#! /usr/bin/env python
from setuptools import setup, Command
from subprocess import check_call
from distutils.spawn import find_executable
import cpplint as cpplint
class Cmd(Command):
'''
Superclass for other commands to run via setup.py, declared in setup.cfg.
These commands will auto-install setup_requ... | XadillaX/xmempool | tools/cpplint/setup.py | Python | mit | 2,955 |
""" Submodule for reading from AGDC
"""
from .agdc_v2_driver import AGDCTimeSeriesDriver
| ceholden/TSTools | tstools/src/ts_driver/drivers/datacube/__init__.py | Python | gpl-2.0 | 89 |
import sys
import os
###############################################################################
## Populate the 'terraphy' namespace
from terraphy import triplets
###############################################################################
## PACKAGE METADATA
__project__ = "terraphy"
__version__ = "1.0"
tr... | zwickl/terraphy | terraphy/__init__.py | Python | mit | 1,739 |
import bisect
import io
import json
import logging
import zipfile
from collections import defaultdict
from babelfish import Language
from guessit import guessit
from requests import Session
from subliminal import __short_version__
from subliminal.cache import region, SHOW_EXPIRATION_TIME
from subliminal.exceptions imp... | h3llrais3r/SickRage | sickchill/providers/subtitle/subscenter.py | Python | gpl-3.0 | 10,017 |
#!/usr/bin/python
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# SimpleCV
# a kinder, gentler machine vision python library
#-----------------------------------------------------------------------
# SimpleCV is an interface for Open Source machine
# vision libraries in Python.
# It provides... | jlegendary/SimpleCV | SimpleCV/Shell/Shell.py | Python | bsd-3-clause | 7,838 |
import collections
import copyreg
import json
import logging
import re
import sys
import pprint
from functools import lru_cache
from typing import BinaryIO
from markdown import Markdown
from markdown.extensions.extra import ExtraExtension
from markdown.preprocessors import Preprocessor
from errbot.backends.base impor... | gbin/err | errbot/backends/slack.py | Python | gpl-3.0 | 46,895 |
#
# 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... | Acehaidrey/incubator-airflow | airflow/hooks/base.py | Python | apache-2.0 | 6,850 |
# Natural Language Toolkit (NLTK) Help
#
# Copyright (C) 2001-2015 NLTK Project
# Authors: Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Provide structured access to documentation.
"""
from __future__ import print_function
import re
from textwrap import w... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/help.py | Python | gpl-2.0 | 1,649 |
from desmod.queue import Queue, PriorityQueue
def test_mq(env):
queue = Queue(env, capacity=2)
def producer(msg, wait):
yield env.timeout(wait)
yield queue.put(msg)
def consumer(expected_msg, wait):
yield env.timeout(wait)
msg = yield queue.get()
assert msg == exp... | bgmerrell/desmod | tests/test_queue.py | Python | mit | 1,789 |
#!/usr/bin/env python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | kubeflow/kfp-tekton-backend | samples/core/condition/condition.py | Python | apache-2.0 | 2,572 |
from numba import vectorize, jit, bool_, double, int_, float_, typeof, int8
import unittest
import numpy as np
def add(a, b):
return a + b
def func(dtypeA, dtypeB):
A = np.arange(10, dtype=dtypeA)
B = np.arange(10, dtype=dtypeB)
return typeof(vector_add(A, B))
class TestVectTypeInfer(unittest.Test... | seibert/numba | numba/tests/test_vectorization_type_inference.py | Python | bsd-2-clause | 1,189 |
import _plotly_utils.basevalidators
class NameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="name", parent_name="choropleth", **kwargs):
super(NameValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit... | plotly/python-api | packages/python/plotly/plotly/validators/choropleth/_name.py | Python | mit | 436 |
import operator
from abc import ABCMeta, abstractmethod
from functools import wraps
from flask import request
from flask._compat import with_metaclass
from .allows import _call_requirement
from .overrides import current_overrides
__all__ = (
"Requirement",
"ConditionalRequirement",
"wants_request",
"... | justanr/flask-allows | src/flask_allows/requirements.py | Python | mit | 6,378 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import re
... | Azure/azure-sdk-for-python | sdk/communication/azure-communication-networktraversal/tests/_shared/helper.py | Python | mit | 1,153 |
# The MIT License
#
# Copyright (C) 2007 Chris Miles
#
# Copyright (C) 2008-2009 Floris Bruynooghe
#
# Copyright (C) 2008-2009 Abilisoft Ltd.
#
#
# 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 Softwa... | stanlyxiang/incubator-hawq | tools/bin/pythonSrc/PSI-0.3b2_gp/setup.py | Python | apache-2.0 | 20,030 |
from django.conf import settings
redis_host = None
redis_port = None
redis_db = None
def get_redis_host():
global redis_host
if not redis_host:
redis_host = getattr(settings, 'SWAMP_DRAGON_REDIS_HOST', 'localhost')
return redis_host
def get_redis_port():
global redis_port
if not redis_p... | seclinch/swampdragon | swampdragon/pubsub_providers/redis_settings.py | Python | bsd-3-clause | 567 |
#!/usr/bin/python
"""
**Fibonacci Sequence**
Enter a number and have the program generate the Fibonacci sequence
to that number or to the Nth number.
"""
def fibonnaciSequence(n):
assert n > 0
sequence = [1] # Initialize sequence to 1
while len(sequence) < n:
if len(sequence) == 1:
# ... | jplindquist/Projects | Numbers/fibonacci.py | Python | mit | 1,140 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module is intended to be used to compute Pourbaix diagrams
of arbitrary compositions and formation energies. If you use
this module in your work, please consider citing the following:
General formalis... | mbkumar/pymatgen | pymatgen/analysis/pourbaix_diagram.py | Python | mit | 41,377 |
#!/usr/bin/env python
from daemon import Daemon, SerialDispatcher
from serial import Serial
import api
from threading import Thread
import sys
def callback(event):
if event:
print(str(event))
def listen(daemon):
while True:
house, unit, act = input().split()
unit = int(unit)
i... | umbc-hackafe/x10-controller | x10d.py | Python | unlicense | 1,143 |
import json
"""
Automatically updates the following json files for the specified version argument:
blocks.json
command_names.json
effects.json
entities.json
Dependencies:
https://github.com/PepijnMC/Minecraft/
https://github.com/Arcensoth/mcdata/
"""
# specifies the path to get to their respe... | Aquafina-water-bottle/Command-Compiler-Unlimited | update_config.py | Python | mit | 3,615 |
from yawf.commands.base import BaseCommand
class Command(BaseCommand):
""" ${command_name}
"""
description = ""
def add_arguments(self, parser):
pass
def handle(self, options):
pass
| andrewyoung1991/yawf | yawf/commands/templates/blank_command.py | Python | mit | 222 |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... | RedhawkSDR/integration-gnuhawk | components/probe_density_b/tests/test_probe_density_b.py | Python | gpl-3.0 | 4,073 |
import findmorsegraph as fmg
import patternmatch as pm
from itertools import permutations
from subprocess import call
import useDSGRN
import sys
# def getAllParams(fname="networks/5D_Malaria_20hr.txt",smallestparam=0,largestparam=8640000,getMorseSet=fmg.is_FP_clock):
# params=fmg.scan(fname,smallestparam,largestp... | goullet/DSGRN | software/Python/PatternMatching/malariapatternmatch_20hr.py | Python | mit | 1,846 |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.monitoring_v3.proto import uptime_pb2 as google_dot_cloud_dot_monitoring__v3_dot_proto_dot_uptime__pb2
from google.cloud.monitoring_v3.proto import uptime_service_pb2 as google_dot_cloud_dot_monitoring__v3_dot_proto_dot... | jonparrott/google-cloud-python | monitoring/google/cloud/monitoring_v3/proto/uptime_service_pb2_grpc.py | Python | apache-2.0 | 8,905 |
#!/usr/bin/env python
import dns
from dnsdisttests import DNSDistTest
class TestSelfAnsweredResponses(DNSDistTest):
_config_template = """
-- this is a silly test config, please do not do this in production.
addAction(makeRule("udp.selfanswered.tests.powerdns.com."), SpoofAction("192.0.2.1"))
addSelfA... | Habbie/pdns | regression-tests.dnsdist/test_SelfAnsweredResponses.py | Python | gpl-2.0 | 2,874 |
from cis_profile.common import WellKnown
from cis_profile.profile import User
import os
class Test_WellKnown(object):
def test_wellknown_file_force(self):
wk = WellKnown(always_use_local_file=True)
data = wk.get_well_known()
assert isinstance(data, dict)
assert isinstance(data.get(... | mozilla-iam/cis | python-modules/cis_profile/tests/test_well_known.py | Python | mpl-2.0 | 1,091 |
# python-pgp A Python OpenPGP implementation
# Copyright (C) 2014 Richard Mitchell
#
# 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 la... | omar-AM/python-pgp | pgp/cipher/__init__.py | Python | gpl-3.0 | 1,228 |
# Copyright (c) 2005-2006 LOGILAB S.A. (Paris, FRANCE).
# Copyright (c) 2005-2006 CEA Grenoble
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the CECILL license, available at
# http://www.inria.fr/valorisation/logici... | Snifer/BurpSuite-Plugins | faraday/gui/qt3/pyqonsole/widget.py | Python | gpl-2.0 | 52,832 |
from django.dispatch import Signal
contact_sent = Signal(providing_args=["request, contact"])
| un33k/django-contactware | contactware/signals.py | Python | bsd-3-clause | 95 |
import pandas as pd
import numpy as np
from ggplot import *
import sys
from random import randint
import datetime
from nltk.sentiment.vader import SentimentIntensityAnalyzer
df = pd.DataFrame()
df = pd.concat([df, pd.read_pickle('data/hangouts.pkl')])
df = pd.concat([df, pd.read_pickle('data/messenger.pkl')])
df.colu... | MasterScrat/ChatShape | experiments.py | Python | mit | 4,239 |
import apt_pkg
apt_pkg.init()
sources = apt_pkg.GetPkgSourceList()
sources.ReadMainList()
cache = apt_pkg.GetCache()
depcache = apt_pkg.GetDepCache(cache)
pkg = cache["libimlib2"]
cand = depcache.GetCandidateVer(pkg)
for (f,i) in cand.FileList:
index = sources.FindIndex(f)
print index
if index:
... | zsjohny/python-apt | doc/examples/indexfile.py | Python | gpl-2.0 | 470 |
import numpy as np
import cv2
from itertools import cycle
# Change these settings. You'll probably need to tweak them for your particular camera.
OUTNAME = 'loop.avi'
BRIGHTNESS = 0.25
CONTRAST = 1
SATURATION = 1
THRESHOLD = 220
ENDTRIGGER = 3
STARTTRIGGER = 5
HSIZE = WSIZE = 2000 # max it out
# '0' here represents... | sabo/loopycam | loopycam.py | Python | unlicense | 2,628 |
# -*- coding: utf-8 -*-
# © 2015 Yannick Vaucher (Camptocamp SA)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
from openerp import exceptions
class TestCreateInvoice(common.TransactionCase):
def test_emit_invoice_with_bvr_reference(self):
self.inv_v... | BT-aestebanez/l10n-switzerland | l10n_ch_base_bank/tests/test_create_invoice.py | Python | agpl-3.0 | 4,816 |
from helpers.types import is_number
import numpy
import sys
import re as regexp
import os
import csv
def load_into_matrix(fname,load_targets=True,num_targets=1,num_attributes=0,skip_first=True,input_delimiter=','):
# source: http://stackoverflow.com/questions/4315506/load-csv-into-2d-matrix-with-numpy... | queirozfcom/ml201401 | helpers/files.py | Python | mit | 1,661 |
from unittest import TestCase
from hri_api.util import RobotConfigParser
class TestRobotConfigParser(TestCase):
def test_load_robot_type(self):
robot_type = RobotConfigParser.load_robot_type("/home/cogbot/catkin_ws/src/hri/hri_api/src/hri_api/tests/test_robot.yaml")
self.assertEqual(robot_type, 'z... | jdddog/hri | hri_api/src/hri_api/tests/test_robot_config_parser.py | Python | bsd-3-clause | 789 |
from exchangelib.errors import (
ErrorAccessDenied,
ErrorFolderNotFound,
ErrorInvalidOperation,
ErrorItemNotFound,
ErrorNoPublicFolderReplicaAvailable,
)
from exchangelib.properties import EWSElement
from .common import EWSTest
class CommonTest(EWSTest):
def test_magic(self):
self.ass... | ecederstrand/exchangelib | tests/test_source.py | Python | bsd-2-clause | 3,703 |
from __future__ import unicode_literals
from pygments.token import Token
from .rules import TokenStream
from .lexer import lex_document
class CompletionHint(object):
def __init__(self, grammar):
self.grammar = grammar
def write(self, cli, screen):
if not (cli.is_exiting or cli.is_aborting o... | Carreau/python-prompt-toolkit | prompt_toolkit/contrib/shell/layout.py | Python | bsd-3-clause | 1,453 |
# 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... | RobinQuetin/CAIRIS-web | cairis/cairis/GoalsDialog.py | Python | apache-2.0 | 2,976 |
#!/usr/bin/python
'''
Generate a region list to rerender certain chunks
This is used to force the regeneration of any chunks that contain a certain
blockID. The output is a chunklist file that is suitable to use with the
--chunklist option to overviewer.py.
Example:
python contrib/rerenderBlocks.py --ids=46,79,91 ... | panfantastic/Minecraft-Overviewer | contrib/rerenderBlocks.py | Python | gpl-3.0 | 2,060 |
#!/usr/bin/env python
from collections import Mapping, Sequence, defaultdict
import datetime
from functools import wraps
import math
try:
from cdecimal import Decimal, InvalidOperation
except ImportError: #pragma: no cover
from decimal import Decimal, InvalidOperation
try:
from collections import Ordered... | eads/journalism | journalism/columns.py | Python | mit | 16,286 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | zhuyongyong/demo-express | tools/varshop.py | Python | bsd-3-clause | 1,935 |
from pylastica.query import Query
from pylastica import Document
from pylastica.aggregation.geodistance import GeoDistance
from pylastica.doc_type import Mapping
from tests.base import Base
__author__ = 'Joe Linn'
import unittest
class GeoDistanceTest(unittest.TestCase, Base):
def setUp(self):
super(Geo... | jlinn/pylastica | tests/aggregation/test_geodistance.py | Python | apache-2.0 | 1,485 |
from __future__ import with_statement
import os
import simplejson
import py.test
from mock import Mock
from ..taskdoit import DoitStable, DoitUnstableNoContinue, DoitUnstable
from ..scheduler import ProcessTask, TaskPause
THIS_PATH = os.path.dirname(os.path.abspath(__file__))
DODO_FILE = os.path.join(THIS_PATH, '__... | schettino72/serveronduty | sodd/tests/test_taskdoit.py | Python | mit | 7,273 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/nekbone/package.py | Python | lgpl-2.1 | 3,143 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
from .cms_menus import ProfileMenu
@apphook_pool.register
class ProfileApp(CMSApp):
# app_name = 'profiles'
name =... | hzlf/openbroadcast.org | website/apps/profiles/cms_apps.py | Python | gpl-3.0 | 466 |
"""
Write out magic strings to magicPlotDocDecorator
"""
from os.path import join
from sys import version_info
import serpentTools
pyVersion = '{}.{}.{}'.format(*version_info[:3])
magicStrings = serpentTools.plot.PLOT_MAGIC_STRINGS
magicOpts = [
'#. ``{key}``: {value}'.format(key=key, value=magicStrings[key])
... | CORE-GATECH-GROUP/serpent-tools | docs/magicPlotDoc.py | Python | mit | 646 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder 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/l... | Danielweber7624/pybuilder | src/unittest/python/ci_server_interaction_tests.py | Python | apache-2.0 | 4,939 |
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
import json
import os
from reportlab.lib import colors, units
from reportlab.platypus import TableStyle
from utils.pdf_generator import generic_pdf
def create_pdf_document(WD, report):
'''
Method to create a ... | awest1339/multiscanner | utils/pdf_generator/__init__.py | Python | mpl-2.0 | 4,427 |
#!/usr/bin/env python
# This Python file uses the following encoding: utf-8
#
# Copyright (C) 2010-2018 Davide Andreoli <dave@gurumeditation.it>
#
# This file is part of EpyMC.
#
# EpyMC is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published ... | DaveMDS/epymc | epymc/plugins/input_webserver/__init__.py | Python | gpl-3.0 | 851 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry.page.actions.all_page_actions import *
from telemetry.page import page as page_module
from telemetry.page import ... | TeamEOS/external_chromium_org | tools/perf/page_sets/intl_hi_ru.py | Python | bsd-3-clause | 1,683 |
# Copyright 2014 OpenStack Foundation
#
# 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 ... | rdo-management/neutron | neutron/db/migration/alembic_migrations/other_extensions_init_ops.py | Python | apache-2.0 | 3,786 |
from tools import *
from keras.models import load_model
import sys
def prepare_data(path):
data = pd.read_csv(path, sep='\t').dropna()
X = np.array([encode_input(x) for x in data['name']])
y = np.array([label_to_number[x] for x in data['label']])
return X,y
charcnn = load_model('/var/www/html/flask... | csgwon/dl-pipeline | flaskapp/tf_predict.py | Python | apache-2.0 | 454 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2010 Benny Malengier
#
# 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; ei... | Fedik/gramps | gramps/gui/editors/displaytabs/surnametab.py | Python | gpl-2.0 | 16,204 |
# Copyright (C) 2006-2007 Jeff Forcier <jeff@bitprophet.org>
#
# This file is part of ssh.
#
# 'ssh' 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.1 of the License, or (at your optio... | bitprophet/ssh | ssh/hostkeys.py | Python | lgpl-2.1 | 10,917 |
import aiohttp
from aiohttp.web_exceptions import HTTPNotFound
import json
from chilero import web
from chilero.web.test import WebTestCase, asynctest
fruits = dict(
orange=dict(
colors=['orange', 'yellow', 'green']
),
strawberry=dict(
colors=['red', 'pink']
),
)
veggies = dict(
cu... | dmonroy/chilero | tests/test_resource.py | Python | mit | 7,828 |
#!/usr/bin/env python
import urllib2,cookielib
import urllib
cookie=cookielib.CookieJar()
opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie))
urllib2.install_opener(opener)
str=urllib.urlencode({'login':'chenzongzhi','passwd':'123456'})
login_response=urllib2.urlopen('http://www.meituan.com/acl/account/log... | nkysg/Asenal | script/pythontmp/mis.py | Python | apache-2.0 | 466 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.core.checks import Error
from django.db import models
from django.test.utils import override_settings
from django.test.testcases import skipIfDBFeature
from .base import IsolatedModelsTestCase
class RelativeFieldTests(IsolatedModelsTestCa... | liavkoren/djangoDev | tests/invalid_models_tests/test_relative_fields.py | Python | bsd-3-clause | 45,353 |
#!/usr/bin/env python
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A script to update the nacl.patch file to match the git checkout.
This encapsulates a step in the naclports workflow.
Chan... | dtkav/naclports | build_tools/update_diff.py | Python | bsd-3-clause | 2,503 |
import psycopg2
import scipy.io
import os
# Create a connection to RoboticBicycle database
conn = psycopg2.connect(database="robot_bicycle_parameters", user="hazelnusse")
cur = conn.cursor()
def insert_statement(cur, table, row):
q = cur.mogrify("insert into " + table + " values(%s, %s, %s, %s, %s);", row)
re... | hazelnusse/robot.bicycle | data/physicalparameters/RawData/PeriodMeasurements/Fork/populateTable.py | Python | bsd-2-clause | 2,360 |
from api.callers.api_caller import ApiCaller
class ApiSubmitReanalyze(ApiCaller):
endpoint_url = '/submit/reanalyze'
endpoint_auth_level = ApiCaller.CONST_API_AUTH_LEVEL_ELEVATED
request_method_name = ApiCaller.CONST_REQUEST_METHOD_POST
| PayloadSecurity/VxAPI | api/callers/submit/api_submit_reanalyze.py | Python | gpl-3.0 | 251 |
import time
from hazelcast.exception import HazelcastError, HazelcastSerializationError
from hazelcast.proxy.map import EntryEventType
from hazelcast.serialization.api import IdentifiedDataSerializable
from hazelcast.serialization.predicate import SqlPredicate
from tests.base import SingleMemberTestCase
from tests.util... | cangencer/hazelcast-python-client | tests/proxy/map_test.py | Python | apache-2.0 | 15,013 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import os
import weakref
from hashlib import sha1
from typing import Optional, Sequence, Union
from pants.base.build_environment import get_buildroot
from pants.base.except... | wisechengyi/pants | src/python/pants/build_graph/target.py | Python | apache-2.0 | 35,536 |
# -*- 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):
# Deleting field 'ToIndexStore.basemodel_ptr'
db.delete_column(u'catalog_... | Makeystreet/makeystreet | woot/apps/catalog/migrations/0029_auto__del_field_toindexstore_basemodel_ptr__add_field_toindexstore_id.py | Python | apache-2.0 | 26,077 |
# See https://www.tensorflow.org/api_docs/python/tf/reduce_sum
import tensorflow as tf
x = tf.constant([[2, 3], [4, 1]])
with tf.Session() as sess:
print(sess.run(tf.reduce_sum(x))) # Result: 2+3+4+1=10
print(sess.run(tf.reduce_sum(x, 0))) # Result: [6 4]
print(sess.run(tf.reduce_sum(x, 1))) # Result: [5 ... | KarateJB/Python.Practice | src/TensorFlow/venv/Lab/Tutorials/Basic/ReduceSum.py | Python | mit | 464 |
from abc import ABCMeta, abstractmethod
import chess
import math
import time
import numpy as np
from collections import namedtuple
from search_helpers import quickselect, material_balance
import guerilla.data_handler as dh
# Note:
# Moves are stored as UCI strings
# Leaf FEN is stripped
Transposition = namedtuple... | StephAO/guerilla | guerilla/play/search.py | Python | mit | 23,421 |
# 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
# d... | NeCTAR-RC/horizon | openstack_dashboard/test/integration_tests/tests/test_users.py | Python | apache-2.0 | 1,687 |
import jinja2
from jinja2 import Environment
templateLoader = jinja2.FileSystemLoader( searchpath="/" )
something = ''
Environment(loader=templateLoader, load=templateLoader, autoescape=True)
templateEnv = jinja2.Environment(autoescape=True,
loader=templateLoader )
Environment(loader=templateLoader, load=templ... | coala/coala-bears | tests/python/bandit_test_files/jinja2_templating.py | Python | agpl-3.0 | 595 |
# This file is part of pylabels, a Python library to create PDFs for printing
# labels.
# Copyright (C) 2012, 2013, 2014 Blair Bonnett
#
# pylabels 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 versio... | bcbnz/pylabels | demos/nametags.py | Python | gpl-3.0 | 3,046 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Pygments
~~~~~~~~
Pygments is a syntax highlighting package written in Python.
It is a generic syntax highlighter for general use in all kinds of software
such as forum systems, wikis or other applications that need to prettify
source code. Hig... | djanowski/pygmentize | vendor/pygments/setup.py | Python | mit | 2,865 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | CasualGaming/studlan | apps/lan/migrations/0001_initial.py | Python | mit | 1,962 |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants.backend.python.targets.python_app import PythonApp
from pants.base.... | twitter/pants | src/python/pants/backend/python/tasks/python_bundle.py | Python | apache-2.0 | 3,763 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import itertools
import numpy as n... | mlperf/training_results_v0.6 | NVIDIA/benchmarks/transformer/implementations/pytorch/fairseq/tasks/translation.py | Python | apache-2.0 | 6,479 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Mistobaan/tensorflow | tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py | Python | apache-2.0 | 20,278 |
# Copyright 2016-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
#
# or in the "license" f... | gregbdunn/aws-ec2rescue-linux | tools/moduletests/unit/test_arpignore.py | Python | apache-2.0 | 13,751 |
import json
import os
import demistomock as demisto # noqa: F401
import requests
from CommonServerPython import * # noqa: F401
from requests.auth import HTTPBasicAuth
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
USERNAME = demisto.params().get('credentials')['identifier']
PASSWORD = dem... | demisto/content | Packs/UnisysStealth/Integrations/UnisysStealth/UnisysStealth.py | Python | mit | 6,075 |
file_path_failed_tests = "failed.json"
file_path_status = "status.json"
file_path_network_peers = "routers_geo.json"
ping_count = 1
ping_warn_percent_loss = 20
mail_to_address = 'To Address <to-address@example.com>'
mail_from_address = 'Status Update <no-reply@example.com>'
mail_subject = 'Peer Router Status'
| spgreen/ping_geo_json | conf/main_conf.py | Python | mit | 314 |
# Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
#
# For example,
# Given [100, 4, 200, 1, 3, 2],
# The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4.
#
# Your algorithm should run in O(n) complexity.
# A simple solution but with time co... | lijunxyz/leetcode_practice | longest_consecutive_sequence_hard/Solution1.py | Python | mit | 2,601 |
# -*- coding: utf-8 -*-
from openupgradelib import openupgrade
@openupgrade.migrate(use_env=True)
def migrate(env, version):
# los hacemos actualizables a partir de esta version
env['ir.model.data'].search([
('module', '=', 'l10n_ar_account', ),
('name', 'in', ['validator_numero_factura', 'val... | jobiols/odoo-argentina | l10n_ar_account/migrations/9.0.1.18.0/post-migration.py | Python | agpl-3.0 | 468 |
import os
import sys
import cPickle
import numpy as np
# PARAMS
log_dir = "/scratch/sforestier001/logs/CogSci2017/2017-01-17_19-32-17-EXPLO-0.5"
config_list = ["RMB", "AMB"]
n_iter = 500
# RETRIEVE LOGS
trial_list = range(1,n_iter + 1)
data_vocal = {}
data_competence = {}
data_progress = {}
for config_name in c... | sebastien-forestier/CogSci2017 | scripts/analysis_retrieve.py | Python | gpl-3.0 | 2,503 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('restaurants', '0002_menuitem'),
]
operations = [
migrations.AddField(
model_name='restaurant',
name=... | mirabel-ekwenugo/food-orders | restaurants/migrations/0003_restaurant_menu.py | Python | mit | 414 |
from . import AutoEncodingTopicModeling
from . import GensimTopicModeling
from . import LatentTopicModeling
| stephenhky/PyShortTextCategorization | shorttext/generators/bow/__init__.py | Python | mit | 109 |
### Computer Science with Applications III
### Analyzing NYC Taxi Data
### Lauren Dyson, Carlos Grandet, Hector Salvador
### June 2016
import requests
import csv
APIKEY='c2c020da0fa05178acf39b4f9dba3efd'
ARTISTS = ['lady%20gaga', 'drake', 'alicia%20keys', 'lil%20wayne', 'chris%20brown', 'rihanna', 'coldplay',
'kat... | ladyson/123bigdata | concerts/get_bands.py | Python | mit | 2,719 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_insured/__openerp__.py | Python | agpl-3.0 | 2,681 |
__author__ = 'royrusso'
from unittest import TestCase
import predikto
from .test_util import base_url, logger
class TestUpload(TestCase):
def test_upload(self):
logger.info('in test_upload')
# Set credential for default api
predikto.configure(configs={'base_url': base_url})
res... | predikto/python-sdk | tests/test_upload.py | Python | apache-2.0 | 597 |
from __future__ import absolute_import
from hashlib import sha1
from django.core.urlresolvers import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from sentry import options
from sentry.models import ApiToken, FileBlob, MAX_FILE_SIZE
from sentry.testutils import APITestCase
from sentry.api.en... | mvaled/sentry | tests/sentry/api/endpoints/test_chunk_upload.py | Python | bsd-3-clause | 5,792 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.