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
# --------------------------------------------------------------------------
# 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/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployments_operations.py | Python | mit | 55,988 |
from logging import getLogger
from pordego_complexity.blocks import find_complex_blocks
from pordego_complexity.complexity_config import ComplexityConfig
from pordego_complexity.radon_lib import build_radon_config, run_radon_analysis
logger = getLogger(__name__)
def get_complex_blocks(complexity_config):
... | ttreptow/pordego-complexity | pordego_complexity/complexity_analysis.py | Python | mit | 1,969 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'Application.views.Index.index'),
url(r'^index/$', 'Application.views.Index.index'),
url(... | jonathanguartan/GePTCOdont | GePTCOdont/urls.py | Python | unlicense | 4,381 |
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | hgascon/pulsar | pulsar/core/sippy/UacStateRinging.py | Python | bsd-3-clause | 5,584 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import unittest
import logging
import json
from cameo.parserV2ForINDIEGOGO import ParserV2ForINDIEGOGO
"""
INDIEGOGO 改版 2016-05-27... | muchu1983/104_cameo | test/unit/test_parserV2ForINDIEGOGO.py | Python | bsd-3-clause | 1,576 |
def validate_bundle(bundle):
return []
| makyo/juju-bundleparser | bundleparser/validate.py | Python | lgpl-3.0 | 43 |
# Copyright (c) 2013, Nathan Dunsworth - NFXPlugins
# 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... | ndunsworth/python-shotgunorm | ShotgunORM/SgScriptFields.py | Python | bsd-3-clause | 16,365 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 1118 João Pedro Rodrigues
#
# 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
#
# Unl... | haddocking/pdb-tools | tests/test_pdb_splitseg.py | Python | apache-2.0 | 8,023 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-11-08 17:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization_network', '0056_auto_20161108_1619'),
]
operations = [
migrati... | Ircam-Web/mezzanine-organization | organization/network/migrations/0057_auto_20161108_1807.py | Python | agpl-3.0 | 753 |
from django import forms
from miniURL.models import Redirection
#Pour faire un formulaire depuis un modèle. (/!\ héritage différent)
class RedirectionForm(forms.ModelForm):
class Meta:
model = Redirection
fields = ('real_url', 'pseudo')
# Pour récupérer des données cel apeut ce faire avec un POST... | guillaume-havard/testdjango | sitetest/miniURL/forms.py | Python | mit | 615 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2012 Matias Bordese
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ri... | reddit/stinkypy | stinkypy/unidiff/__init__.py | Python | mit | 1,254 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import pytest
from wa_kat.db import request_info
from wa_kat.db.request_info import worker_mapping
# Variables =========================================... | WebArchivCZ/WA-KAT | tests/db/_test_request_info.py | Python | mit | 1,991 |
"""
The streams module defines the streams API that allows visualizations to
generate and respond to events, originating either in Python on the
server-side or in Javascript in the Jupyter notebook (client-side).
"""
import sys
import weakref
from numbers import Number
from collections import defaultdict
from contextl... | ioam/holoviews | holoviews/streams.py | Python | bsd-3-clause | 66,360 |
from _base import *
class SConsProjectChecker(BaseLibChecker):
'''
Default configuration.
'''
def __init__( self ):
self.name = 'sconsProject'
pass
def initOptions(self, project, opts):
self.initOption_with(project, opts)
return True
def configure(self, proje... | tuttleofx/sconsProject | autoconf/sconsProject.py | Python | mit | 2,230 |
from setuptools import setup, find_packages
import sys, os
py_version = sys.version_info[:2]
PY3 = py_version[0] == 3
if PY3:
if py_version < (3, 2):
raise RuntimeError('On Python 3, Pyramid requires Python 3.2 or better')
else:
if py_version < (2, 6):
raise RuntimeError('On Python 2, Pyramid... | mmerickel/anykeystore | setup.py | Python | mit | 1,979 |
#!/usr/bin/python2.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# $Id$
#
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
#
# This library 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... | xiangke/pycopia | net/test.py | Python | lgpl-2.1 | 2,713 |
# pylint: disable=C0103,C0111
import unittest
import importlib
import mock
from bumblebee.engine import all_modules
from bumblebee.config import Config
from tests.util import assertWidgetAttributes, MockEngine
class MockCommunicate(object):
def __init__(self):
self.returncode = 0
def communicate(sel... | TechRunner2/i3-gaps-rice | .config/i3/bar/tests/modules/test_modules.py | Python | gpl-2.0 | 2,095 |
import math
import random
import time
import json
from collections import deque
from pyglet import image
from pyglet.gl import *
from pyglet.graphics import TextureGroup
from pyglet.window import key, mouse
TICKS_PER_SEC = 60
# Size of sectors used to ease block loading.
SECTOR_SIZE = 16
WALKING_SPEED = 5
FLYING_SP... | GerardoGR/piecraft | main.py | Python | mit | 35,830 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | 3v1n0/snapcraft | snaps_tests/demos_tests/test_gradle_with_outputdir.py | Python | gpl-3.0 | 1,101 |
from __future__ import print_function
from six import text_type
from typing import cast, Any, Iterable, Mapping, Optional, Sequence, Tuple
import mandrill
from confirmation.models import Confirmation
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template import loade... | TigorC/zulip | zerver/lib/notifications.py | Python | apache-2.0 | 22,757 |
# coding=utf-8
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.product_list, name='product_list'),
url(r'^(?P<slug>[\w_-]+)/$', views.category, name='category'),
url(r'^produtos/(?P<slug>[\w_-]+)/$', views.product, name='product'),
]
| leorocco/estudo-django | catalog/urls.py | Python | cc0-1.0 | 286 |
# Copyright 2015: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | paboldin/rally | rally/plugins/openstack/context/vm/image_command_customizer.py | Python | apache-2.0 | 4,825 |
#import bisect
#from model.rbac.Role import Role
#from model.rbac.AuthUser import AuthUser
#from framework.security.Crypto import Crypto
#from model.rbac.AuthToken import AuthToken
#from model.rbac.ResourcePermission import ResourcePermission
#from framework.interfaces.DocumentStore import Query
#from framework.model.D... | cloud9ers/j25framework | rbac/lib/RBACSystem.py | Python | lgpl-3.0 | 23,286 |
"""
Benchmark models.
"""
from sqlalchemy import Column, Integer, MetaData, String, create_engine
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy.pool import QueuePool
def get_engine(settings):
return create_engine(
settings["sqlalchemy.url"],
poolclass=QueuePool,
... | jamming/FrameworkBenchmarks | frameworks/Python/pyramid/frameworkbenchmarks/models.py | Python | bsd-3-clause | 1,131 |
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, EVEthing team
# 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... | cmptrgeekken/evething | thing/models/stargate.py | Python | bsd-2-clause | 2,311 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | jjshoe/ansible-modules-core | cloud/vmware/vsphere_guest.py | Python | gpl-3.0 | 65,239 |
'''
Double Tap
==========
Search touch for a double tap
'''
__all__ = ('InputPostprocDoubleTap', )
from kivy.config import Config
from kivy.vector import Vector
from kivy.clock import Clock
class InputPostprocDoubleTap(object):
'''
InputPostProcDoubleTap is a post-processor to check if
a touch is a dou... | nuigroup/kivy | kivy/input/postproc/doubletap.py | Python | lgpl-3.0 | 3,028 |
import lib.record_rate
import lib.pushdata
import lib.puylogger
import lib.jolostart
import lib.commonclient
import lib.getconfig
import datetime
import json
hrest_url = lib.getconfig.getparam('HBase-Rest', 'url')
cluster_name = lib.getconfig.getparam('SelfConfig', 'cluster_name')
java = lib.getconfig.getparam('HBase-... | net-angels/puypuy | checks_available/check_hbase_rest.py | Python | apache-2.0 | 7,947 |
from configyaml.config import PositiveIntegerNode, StringNode, WildcardDictNode, BoolNode, RegexNode
from configyaml.loader import ConfigLoader
class DummyPosIntLoader(ConfigLoader):
config_root_class = PositiveIntegerNode
def test_wildcard_dict_invalid_key():
value = {'_bad': 'key'}
c = WildcardDictNod... | dropseedlabs/configyaml | tests/test_nodes.py | Python | mit | 2,206 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-04 12:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0013_auto_20161008_2020'),
]
operations = [
migrations.AlterFiel... | eedf/jeito | members/migrations/0014_auto_20170204_1351.py | Python | mit | 803 |
"""linux.unknown.copy"""
empty = True
| redshodan/cairn | src/python/cairn/sysdefs/linux/unknown/copy/__init__.py | Python | gpl-2.0 | 38 |
import math
import numpy as np
from beprof.profile import Profile
class LateralProfile(Profile):
def penumbra_right(self):
"""
In case of good data returns floating-point number
In case of corrupted data returns nan
"""
return self.x_at_y(0.1, True) - self.x_at_y(0.9, Tru... | grzanka/ibodata | ibodata/lateral_profile.py | Python | gpl-3.0 | 6,329 |
# -*- coding: utf-8 -*-
from trapp.checker import Checker
from trapp.competition import Competition
class CheckerGames(Checker):
def reviewCompetition(self, competition, year):
self.log.message('Reviewing competition ' + str(competition))
# Get years this competition was held
sql = ("SEL... | matt-bernhardt/trapp | trapp/check_games.py | Python | gpl-2.0 | 1,339 |
# encoding: 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):
# Deleting model 'Repute'
db.delete_table(u'repute')
# Deleting model 'Vote'
... | CLLKazan/iCQA | qa-engine/forum/migrations/0024_auto__del_repute__del_vote__del_answer__del_flaggeditem__del_anonymous.py | Python | gpl-3.0 | 28,823 |
from .dummy import name # relative import to get name
def greetings():
return 'hello world'
| thought-machine/please | test/python_rules/pytest/relative_imports/__init__.py | Python | apache-2.0 | 99 |
from django.shortcuts import render
def index(request):
return render(request,
'modelanswers/index.html')
| jluttine/django-modelanswers | modelanswers/views.py | Python | agpl-3.0 | 134 |
import json
from .oauth import OAuth2Test
class InstagramOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.instagram.InstagramOAuth2'
user_data_url = 'https://api.instagram.com/v1/users/self'
expected_username = 'foobar'
access_token_body = json.dumps({
'access_token': 'foobar',
... | tobias47n9e/social-core | social_core/tests/backends/test_instagram.py | Python | bsd-3-clause | 1,771 |
from imp import reload
from django.test import TestCase
from webpack_loader import utils, config, loader
DEFAULT_CONFIG = 'DEFAULT'
LOADER_PAYLOAD = {'status': 'done', 'chunks': []}
class ValidCustomLoader(loader.WebpackLoader):
def load_assets(self):
return LOADER_PAYLOAD
class CustomLoadersTestCase... | kawamon/hue | desktop/core/ext-py/django-webpack-loader-1.0.0/tests/app/tests/test_custom_loaders.py | Python | apache-2.0 | 1,970 |
""" Capturing edits for files, currently only from command line traffic """
import traffic, os, logging, shutil
class FileEditTraffic(traffic.ResponseTraffic):
typeId = "FIL"
linkSuffix = ".CAPTUREMOCK_SYMLINK"
deleteSuffix = ".CAPTUREMOCK_DELETION"
replayFileEditDir = None
recordFileEditDir = No... | emilybache/texttest-runner | src/main/python/lib/capturemock/fileedittraffic.py | Python | mit | 4,551 |
#! python3.4 -b
THEME_NAME = 'NodejsToolsInteractive'
THEME_PKGDEF = 'Microsoft.NodejsTools.InteractiveWindow.theme.v{}.0.pkgdef'
import struct
import xml.etree.ElementTree
from pathlib import WindowsPath
from uuid import UUID
for VS_VERSION in (11, 12, 14, 15):
print('Writing to {}'.format(THEME_PKGDEF.format(V... | AustinHull/nodejstools | Nodejs/Product/InteractiveWindow/Theme/make_theme_pkgdef.py | Python | apache-2.0 | 2,487 |
#!/usr/bin/env python
# This code uses the trained parameters of the Q-Classifier to predict the threshold for the test input data.
# -- by Harsh Shrivastava, XRCI, IIT Kharagpur
import ImpactQ, sys, os, pickle
import numpy as np
def my_sigmoid(x):
return 1.0/ (1 + np.exp(-x))
# the major and minor classes... Im... | Harshs27/Q-Classifier | python/ThwQ.py | Python | mit | 4,087 |
#!/usr/bin/python
import os
import tempfile
import unittest
import sys
from avocado.utils import process
# simple magic for using scripts within a source tree
basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if os.path.isdir(os.path.join(basedir, 'virttest')):
sys.path.append(basedir)
from... | CongLi/avocado-vt | selftests/unit/test_utils_misc.py | Python | gpl-2.0 | 7,839 |
import discord
from pomodorobot.dbmanager import db_manager
from datetime import datetime, timedelta
class ChannelTimerInterface:
""" Defines things related to a timer but not part of one, that a bot makes
use of.
"""
def __init__(self, channel: discord.Channel):
# The channel this inte... | VicenteRD/PomodoroBot | pomodorobot/channeltimerinterface.py | Python | gpl-3.0 | 5,045 |
# Copyright 2019 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from common_kube import KubeTest
class TestLabelAction(KubeTest):
def test_label_action(self):
factory = self.replay_flight_data()
p = self.load_policy(
{
... | capitalone/cloud-custodian | tools/c7n_kube/tests/test_labels.py | Python | apache-2.0 | 2,332 |
import socket
from flask import Blueprint, render_template, request, flash, json, jsonify
from flask.ext.babel import gettext as _
from flask.ext.login import login_required, current_user
from .forms import PhoneNumberForm
from .models import PhoneNumber, Message, Call, Gateway
from ..decorators import returns_json
f... | rootio/rootio_web | rootio/telephony/views.py | Python | agpl-3.0 | 8,737 |
"""
Support for getting statistical data from a DWD Weather Warnings.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.dwd_weather_warnings/
Data is fetched from DWD:
https://rcccm.dwd.de/DE/wetter/warnungen_aktuell/objekt_einbindung/objekteinbindu... | joopert/home-assistant | homeassistant/components/dwd_weather_warnings/sensor.py | Python | apache-2.0 | 8,248 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Migration Script Package
@copyright: 2006 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin.util import pysupport
# create a list of extension scripts from the subpackage directory
migration_scripts = pysupport.getPackageModu... | RealTimeWeb/wikisite | MoinMoin/script/migration/__init__.py | Python | apache-2.0 | 363 |
"""
WSGI config for cityinfo 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local_adam")
from django.co... | azul-cloud/cityinfo | cityinfo/wsgi.py | Python | mit | 393 |
import unittest2 as unittest
from slimta.policy.split import RecipientSplit, RecipientDomainSplit
from slimta.envelope import Envelope
class TestPoliySplit(unittest.TestCase):
def test_recipientsplit_apply(self):
env = Envelope('sender@example.com', ['rcpt1@example.com',
... | fisele/slimta-abusix | test/test_slimta_policy_split.py | Python | mit | 4,579 |
# Copyright (C) 2014 Xinguard, Inc.
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICE... | elahejalalpour/ELRyu | ryu/lib/bfdlib.py | Python | apache-2.0 | 35,512 |
import datetime
import hashlib
import os
import time
from warnings import (
catch_warnings,
simplefilter,
)
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Timestam... | datapythonista/pandas | pandas/tests/io/pytables/test_store.py | Python | bsd-3-clause | 32,047 |
# -*- coding:utf-8 -*-
"""Configuration options for the osm reporter app.
:copyright: (c) 2013 by Tim Sutton
:license: GPLv3, see LICENSE for more details.
"""
# List of OSM pseudos
CREW = []
# Default bbox
BBOX = '20.411482,-34.053726,20.467358,-34.009483'
# Whether to display the "update stats control" on the map
DIS... | Gustry/osm-reporter | reporter/config/default.py | Python | gpl-3.0 | 546 |
#
# linter.py
# Markdown Linter for SublimeLinter, a code checking framework
# for Sublime Text 3
#
# Written by Jon LaBelle
# Copyright (c) 2018 Jon LaBelle
#
# License: MIT
#
"""This module exports the Markdownlint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class MarkdownLint(NodeLinter):
... | jonlabelle/SublimeLinter-contrib-markdownlint | linter.py | Python | mit | 870 |
from django.shortcuts import render
from django.http import HttpResponse, Http404
from rekishi.api import db
from rekishi.api import influxdb_dataset, influxdb_series
from rekishi.api.response_builder import dygraph_response
from rekishi.api.query_builder import InfluxQueryHelper
import json
def bypass(request):
... | savoirfairelinux/rekishi | rekishi/api/views.py | Python | gpl-3.0 | 3,417 |
# 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... | nextsmsversion/macchina.io | platform/JS/V8/v8-3.28.4/PRESUBMIT.py | Python | apache-2.0 | 7,096 |
# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for Sprint pages and views."""
__metaclass__ = type
from testtools.matchers import Equals
from lp.app.enums import InformationType
from lp.testing import BrowserTe... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/blueprints/browser/tests/test_sprint.py | Python | agpl-3.0 | 1,988 |
"""Model interface for a representation module."""
from reader import Reader
from writer import Writer
content_type = 'text/plain; charset=utf-8'
name = "unknown"
suffix = ".unknown"
def dump(self):
raise NotImplementedError
def load(self):
raise NotImplementedError
class Reader(Reader):
pass
clas... | openregister/entry | openregister/representation.py | Python | mit | 439 |
########################################################################
# File name: list_presence.py
# This file is part of: aioxmpp
#
# LICENSE
#
# This program 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 Fo... | horazont/aioxmpp | examples/list_presence.py | Python | lgpl-3.0 | 2,996 |
class ParameterDescriptor:
name = ""
description = ""
param_type = None
default_value = 0
min_value = None
max_value = None
def __init__(self, name, description, param_type, default_value, min_value=None, max_value=None):
self.name = name
self.description = description
... | ETS-Robotics/ros_vision | scripts/RosVision/Filters/parameter_descriptor.py | Python | gpl-3.0 | 822 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
This module contains the definition of some objects used in the chemenv package.
"""
__author__ = "David Waroquiers"
__copyright__ = "Copyright 2012, The ... | gpetretto/pymatgen | pymatgen/analysis/chemenv/utils/defs_utils.py | Python | mit | 4,295 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
# from datetime import timedelta, datetime
from yamo import (
Connection,
EmbeddedDocument, Document, IDFormatter, Index,
StringField,
IntField,
FloatField,
BooleanField,
ListField,
EmbeddedField,
DateTimeField,
)
conn = ... | yxdong/ybk | zg/models.py | Python | mit | 3,701 |
from code_intelligence import graphql
import fire
import github3
import json
import logging
import os
import numpy as np
import pprint
import retrying
import json
TOKEN_NAME_PREFERENCE = ["INPUT_GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_TOKEN"]
for token in TOKEN_NAME_PREFERENCE:
if os.... | kubeflow/code-intelligence | py/notifications/notifications.py | Python | mit | 6,630 |
import os
import time
class Logger:
def __init__(self, debug=False, append=None, custom_run_name=None):
self.debug = debug
if self.debug:
return
output_folder = './output/'
run_folder = 'run%Y%m%d-%H%M%S' if custom_run_name is None else custom_run_name
if not o... | bjaraujo/bombermaaan | openai-gym/gym-bombermaaan/Logger.py | Python | gpl-3.0 | 2,124 |
from django.conf import settings
from django.contrib.gis.geoip2 import GeoIP2
from geoip2.errors import AddressNotFoundError
def get_geo_location_data_for_ip(ip_address):
if not hasattr(settings, 'GEOIP_PATH'):
return None
g = GeoIP2()
try:
location = g.city(ip_address)
except Address... | mikkokeskinen/tunnistamo | users/utils.py | Python | mit | 380 |
# Copyright 2016 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 writing, so... | aherlihy/elastic2-doc-manager | tests/test_elastic2_doc_manager.py | Python | apache-2.0 | 9,610 |
# -*- coding:utf-8 -*-
from django.views.generic.list import ListView
from .. import constants
class DentexchangeListView(ListView):
paginate_by = constants.PAGINATE_BY
| hellhovnd/dentexchange | dentexchange/apps/libs/views/list.py | Python | bsd-3-clause | 175 |
"""
Code that helps to deal with content from git repositories
"""
import os, logging
import error
from autotest_lib.client.bin import utils, os_dep
__all__ = ["GitRepoHelper", "get_repo"]
class GitRepoHelper(object):
'''
Helps to deal with git repos, mostly fetching content from a repo
'''
def __... | libvirt/autotest | client/common_lib/git.py | Python | gpl-2.0 | 6,103 |
#!/usr/bin/env python
# coding: utf-8
from wxbot import *
import ConfigParser
import json
import recomend
import myredispool
class TulingWXBot(WXBot):
def __init__(self):
WXBot.__init__(self)
self.tuling_key = ""
self.robot_switch = True
self.redis = myredispool.RedisCache()
... | kzx1025/wxBot | bot.py | Python | apache-2.0 | 15,846 |
from ete_dev import Tree, TextFace, NodeStyle, TreeStyle
def get_example_tree():
t = Tree("((a,b),c);")
right_c0_r0 = TextFace("right_col0_row0")
right_c0_r1 = TextFace("right_col0_row1")
right_c1_r0 = TextFace("right_col1_row0")
right_c1_r1 = TextFace("right_col1_row1")
right_c1_r2 = Text... | khughitt/ete | examples/treeview/face_grid.py | Python | gpl-3.0 | 1,641 |
import itertools
import random
import sys
import vntypes
# List of quote objects
quotes = []
# Map of character ID -> character object
characters = {}
# Map of novel ID -> novel object
novels = {}
def ifilter(pred, it):
if sys.version_info[0] < 3:
return itertools.ifilter(pred, it)
else:
r... | apsun/VNaaS | web/vndb_python.py | Python | mit | 4,526 |
#!/usr/bin/env python
# (c) 2012-2013 Anaconda, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
from subprocess import check_output, PIPE, Popen, STDOUT
from os.path import join,... | pelson/conda-build | docs/scrape_help.py | Python | bsd-3-clause | 7,618 |
from importlib import import_module
import os
import sys
import commands
class Command(object):
def print_help(self):
pass
def run_from_argv(self,argv):
try:
path=os.path.split(os.path.realpath(__file__))[0]
npos1=path.rfind("/")
npos2=path.rfind("/",0,npos1)... | daxia4444/djangospider | djangospider/management/commands/runmonitor.py | Python | apache-2.0 | 721 |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.exceptions import CloseSpider
from scrapy import Request, FormRequest, Selector
from datetime import date
from collections import OrderedDict
from json import loads
from random import randint
import json, re, collections
import datetime, time
import logging
# Remove... | hanjihun/Car | compreseguros_com/compreseguros_com/spiders/compreseguros_com_spider.py | Python | mit | 8,164 |
from newrelic.agent import (wrap_object, ObjectProxy, wrap_function_wrapper,
register_database_client, FunctionTrace, callable_name,
DatabaseTrace, current_transaction)
from .database_dbapi2 import (ConnectionWrapper as DBAPI2ConnectionWrapper,
ConnectionFactory as DBAPI2ConnectionFactory)
cla... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/newrelic-2.46.0.37/newrelic/hooks/database_psycopg2.py | Python | agpl-3.0 | 2,669 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickGear.
#
# SickGear 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,... | jetskijoe/SickGear | sickbeard/db.py | Python | gpl-3.0 | 19,942 |
# Copyright 2013 Red Hat 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 ag... | devendermishrajio/nova_test_latest | nova/tests/unit/objects/test_block_device.py | Python | apache-2.0 | 16,751 |
import vim
from translate import Translator
def main():
word = vim.eval("s:word")
translator = Translator(to_lang="ru")
print translator.translate(word)
if __name__ == "__main__":
main()
| iadept/vim-gtranslate | plugin/gtranslate.py | Python | gpl-2.0 | 194 |
import time
import re
import keyword
import builtins
from tkinter import TkVersion
from idlelib.Delegator import Delegator
from idlelib.configHandler import idleConf
DEBUG = False
def any(name, alternates):
"Return a named group pattern matching list of alternates."
return "(?P<%s>" % name + "|".join(alternat... | bgris/ODL_bgris | lib/python3.5/idlelib/ColorDelegator.py | Python | gpl-3.0 | 10,598 |
__author__ = 'Bohdan Mushkevych'
from threading import RLock
from bson import ObjectId
from odm.document import BaseDocument
from synergy.db.manager import ds_manager
from synergy.system.decorator import thread_safe
def build_db_query(fields_names, field_values):
""" method builds query dictionary by zipping t... | mushkevych/scheduler | synergy/db/dao/base_dao.py | Python | bsd-3-clause | 3,055 |
""" $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... | stanford-mast/nn_dataflow | nn_dataflow/tests/map_strategy_test/test_map_strategy_fixture.py | Python | bsd-3-clause | 2,988 |
# Copyright 2000 - 2013 NeuStar, Inc.All rights reserved.
# NeuStar, the Neustar logo and related names and logos are registered
# trademarks, service marks or tradenames of NeuStar, Inc. All other
# product names, company names, marks, logos and symbols may be trademarks
# of their respective owners.
__author__ = 'Jon... | EricSchles/python_rest_api_client | src/connection.py | Python | apache-2.0 | 3,894 |
from rest_framework.renderers import JSONRenderer
import re
def underscoreToCamel(match):
return match.group()[0] + match.group()[2].upper()
def camelize(data):
if isinstance(data, dict):
new_dict = {}
for key, value in data.items():
new_key = re.sub(r"[a-z]_[a-z]", underscoreToCam... | tfink419/southeast-fl-jews | utils/api/renderers.py | Python | mit | 731 |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
'''
AREA BREAKDOWN
- DEBUGGER COMMANDS
The debugger recognizes the following commands. Most commands can ... | IronLanguages/ironpython3 | Tests/debugging/pdb_mod/__init__.py | Python | apache-2.0 | 12,523 |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#--------------------------------------------------------------------... | BurtBiel/azure-cli | src/azure-cli-core/azure/cli/core/_logging.py | Python | mit | 5,174 |
import os
import osiris
import globalvars
class OmlRotator(osiris.OMLHtmlWrapper):
def __init__(self, tag):
osiris.OMLHtmlWrapper.__init__(self, tag, "div", False, "", "", "")
def processHtml(self, item, context):
extensionID = globalvars.extension.getID().getString()
context.page.addJavascript("/... | OsirisSPS/osiris-sps | client/data/extensions/148B613D055759C619D5F4EFD9FDB978387E97CB/scripts/oml/rotator.py | Python | gpl-3.0 | 610 |
# -*- coding: utf-8 -*-
"""
Modulo per la gestione del database e della persistenza tramite semplici file
testuali.
Tutti i file gestiti con il database si trovano nelle cartelle data/ oppure
persistence/, questi vengono caricati dal metodo db.load(), ogni singolo file
è caricato con la funzione fread() e salvato con ... | Onirik79/aaritmud | src/database.py | Python | gpl-2.0 | 96,134 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Contour utilities
"""
import cv2
import numpy as np
__all__ = ["meanCenter", "scaleByRefpoint", "extractPolygonMask", "expandRectangle",
"cropBorderFraction", "filter_min_area", "filter_max_area",
"sort_by_area", "contour_mask"]
def meanCenter(... | ulikoehler/cv_algorithms | cv_algorithms/contours.py | Python | apache-2.0 | 6,014 |
# !/usr/bin/python
# -*- coding=utf-8 -*-
from django import forms
from django.contrib import admin
from django.contrib.admin.views import main
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import ugettext_... | lnybrave/zzbook | account/admin.py | Python | apache-2.0 | 3,023 |
"""
Cyclone application for Vumi Go contacts API.
"""
from vumi.persist.txriak_manager import TxRiakManager
from go_api.cyclone.handlers import ApiApplication
from go_contacts.backends.riak import (
RiakContactsBackend, RiakGroupsBackend, ContactsForGroupBackend)
from go_contacts.handlers import ContactsForGroupH... | praekelt/go-contacts-api | go_contacts/server.py | Python | bsd-3-clause | 2,677 |
"""
.. _compute_ica:
=======================
01. Preprocess EEG data
=======================
The :ref:`preprocessing pipeline <preproc_meeg>` pipeline runs the ICA
algorithm for an automatic removal of eyes and heart related artefacts.
A report is automatically generated and can be used to correct
and/or fine-tune the... | neuropycon/ephypype | doc/workshop/eeg/plot_eeg_preprocessing.py | Python | bsd-3-clause | 9,857 |
from django.db import transaction
from rest_framework import serializers
from questions.models import Question, Choice
from votes.models import Vote, VoteChoice
from streams.models import Stream
from ..accounts.serializers import AccountSerializer
class VoteChoiceUserSerializer(serializers.ModelSerializer):
use... | ballotify/django-backend | ballotify/apps/api_v1/questions/serializers.py | Python | agpl-3.0 | 4,502 |
#!/usr/bin/env python3
"""Take repeatables and save it to the database"""
from os import environ
import json
import psycopg2
# with open("db_config") as file:
# HOST = file.readline().strip()
# DBNAME = file.readline().strip()
# USER = file.readline().strip()
# PASS = file.readline().strip()
#
# CONN_... | Fidge123/league-unlock-challenge | src/FillRepeatableTable.py | Python | gpl-3.0 | 1,262 |
"""Helper methods for constructing trajectory functions in model_builder.py."""
import functools
from jax_cfd.base import array_utils
def with_preprocessing(fn, preprocess_fn):
"""Generates a function that computes `fn` on `preprocess_fn(x)`."""
@functools.wraps(fn)
def apply_fn(x, *args, **kwargs):
return... | google/jax-cfd | jax_cfd/ml/model_utils.py | Python | apache-2.0 | 3,033 |
# encoding: utf-8
#
# Copyright (c) 2009 Thomas Kongevold Adamcik
#
# Snippet is released under the MIT License. So feel free to use it in other
# projects as long as the notice remains intact :)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated d... | aptivate/intranet | django/intranet/djangovalidation/middleware.py | Python | gpl-3.0 | 9,254 |
# -*- coding: utf-8 -*
# -*- coding: utf-8 -*-
'''
Created on 2015年7月27日
@author: pcithhb
'''
import matplotlib.pyplot as plt
decisionNode = dict(boxstyle="sawtooth", fc="0.8")
leafNode = dict(boxstyle="round4", fc="0.8")
arrow_args = dict(arrowstyle="<-")
#获取叶节点的数目
def getNumLeafs(myTree):
numLeafs = 0
fir... | gatieme/AderXCoding | technology/machine_learning/ID3/id3plot.py | Python | gpl-2.0 | 3,306 |
# -*- coding: utf-8 -*-
#
# 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
#... | Fokko/incubator-airflow | airflow/gcp/sensors/bigquery.py | Python | apache-2.0 | 2,981 |
#!/usr/bin/env python3
"""Script to create an iCal file with birthdays, from the roster csv.
Usage:
./birthdays.py /path/to/csv
"""
import csv
from datetime import datetime
from icalendar import Calendar, Event
DATE_FMT = '%d/%m/%Y'
def create_calendar():
cal = Calendar()
cal.add('prodid', '-//TIKS s... | punchagan/thatte-idli | scripts/birthdays.py | Python | unlicense | 1,158 |
from django.db import models
from django.utils import timezone
class Company(models.Model):
"""
Company model
"""
name = models.CharField(max_length=80, unique=True)
logo = models.ImageField(upload_to='uploads', blank=True, null=True)
slug = models.CharField(max_length=80, unique=True, blank=... | roks0n/nomadboard | nomadboard/nomadboard/company/models.py | Python | mit | 687 |
#!/usr/bin/env python
# (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
#
# All Rights Reserved. See copyright.txt for details and a complete list of authors.
# Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
# $Id$
# NOTICE:
# 1. You must be root to run th... | oregional/tiki | doc/devtools/set_perms.py | Python | lgpl-2.1 | 5,563 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
import sys
import unittest
import numpy as np
# import itk
#import SimpleITK as sitk
# from imcut import pycut
# from imcut import seed_editor_qt
print(sys.argv)
class PycutTest(unittest.TestCase):
interactivetTest = False
#... | mjirik/lisa | tests/itk4_test.py | Python | bsd-3-clause | 3,050 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.