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 ... | v-iam/azure-sdk-for-python | azure-graphrbac/azure/graphrbac/models/group_get_member_groups_parameters.py | Python | mit | 1,131 |
from math import sqrt
def sq_dist(p, q):
return((p[0] - q[0])**2 + (p[1] - q[1])**2)
def linear_search(points, query):
sqd = float("inf")
for point in points:
d = sq_dist(point, query)
if d < sqd:
nearest = point
sqd = d
return(nearest, sqd)
point_list = [(2,... | o-kei/design-computing-aij | ch4_1/nearest_liner.py | Python | mit | 491 |
#!/usr/bin/env python3
# Author: Brian Fiedler 29 June 2016
# Converts the CRUTEM text data files into a convenient Python dictionary.
# Go to http://www.metoffice.gov.uk/hadobs/crutem4/data/download.html and you should see
# a link to http://www.metoffice.gov.uk/hadobs/crutem4/data/station_files/CRUTEM.4.4.0.0.station... | KamilKwiatkowski123/Repozytorium | recipe-580687-1.py | Python | gpl-3.0 | 3,146 |
# Creating user accounts for the Messidge python library
# (c) 2017 David Preece, this work is in the public domain
import sys
from messidge.broker.identity import Identity
if len(sys.argv) != 2:
print("Run: python3 gen_user_account.py user@email", file=sys.stderr)
exit(1)
identity = Identity()
try:
token... | RantyDave/messidge | demo/gen_user_account.py | Python | bsd-2-clause | 493 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.main
-----------------
Main entry point for the `cookiecutter` command.
The code in this module is also a good example of how to use Cookiecutter as a
library rather than a script.
"""
from __future__ import unicode_literals
import logging
import os
fro... | jhermann/cookiecutter | cookiecutter/main.py | Python | bsd-3-clause | 3,903 |
#-*- encoding: utf-8
import maya.cmds
import maya.app.mayabullet as bullet
import maya.OpenMaya
import os.path
import util
class RigidBodyGenerator:
def __init__(self, mmdData, filePath, rigiddict):
self.mmdData = mmdData
self.directory = os.path.dirname(filePath)
#self.nameDict, self.dictFlag = file... | GRGSIBERIA/mmd-transporter | mmd-transporter/importer/rigidgen.py | Python | gpl-2.0 | 8,714 |
# encoding: utf-8
#----------------------------------------
# file.py by Thomas Gläßle
#
# To the extent possible under law, the person who associated CC0 with
# file.py has waived all copyright and related or neighboring rights
# to file.py.
#
# You should have received a copy of the CC0 legalcode along with this
# ... | pymad/cpymad | src/cern/resource/file.py | Python | apache-2.0 | 1,814 |
# Copyright (c) 2011, Shutterstock Images LLC.
# All rights reserved.
#
# This file is subject to the MIT License (see the LICENSE file).
import datetime
import json
import os
import txmongo
import validictory
from twisted.internet import defer
from twisted.python import log
from oplog import utils
PARSE_ERROR = -327... | shutterstock/oplog | oplog/api.py | Python | mit | 8,156 |
#!/usr/bin/env python
# standard library imports
from os.path import exists
# third party related imports
from setuptools import setup, find_packages
# local library imports
from mobile_push import __version__
def read_from_file(filename):
if exists(filename):
with open(filename) as f:
ret... | theKono/mobile-push | setup.py | Python | apache-2.0 | 1,163 |
import cgi
import json
import logging
from copy import deepcopy
from collections import OrderedDict
from lxml import etree
from pkg_resources import resource_string
from xmodule.x_module import XModule, XModuleDescriptor
from xmodule.stringify import stringify_children
from xmodule.mako_module import MakoM... | EduPepperPDTesting/pepper2013-testing | common/lib/xmodule/xmodule/templates/poll_compare_module.py | Python | agpl-3.0 | 10,491 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
STORAGE_A... | Azure/azure-sdk-for-python | sdk/storage/azure-storage-queue/tests/settings/settings_fake.py | Python | mit | 647 |
from __future__ import division, print_function
import cPickle as pickle
from blocks.extensions.saveload import Checkpoint, SAVED_TO
from blocks.serialization import secure_dump
class PartsOnlyCheckpoint(Checkpoint):
def __init__(self, path, **kwargs):
super(PartsOnlyCheckpoint, self).__init__(path=path,... | ablavatski/draw | draw/partsonlycheckpoint.py | Python | mit | 1,714 |
"""The tests for the notify demo platform."""
import tempfile
import unittest
from homeassistant.bootstrap import setup_component
import homeassistant.components.notify as notify
from homeassistant.components.notify import demo
from homeassistant.helpers import script
from homeassistant.util import yaml
from tests.co... | hexxter/home-assistant | tests/components/notify/test_demo.py | Python | mit | 5,298 |
#
# Kiwi: a Framework and Enhanced Widgets for Python
#
# Copyright (C) 2005 Async Open Source
#
# 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 Foundation; either
# version 2.1 of the License, or (a... | fboender/miniorganizer | src/lib/kiwi/ui/comboboxentry.py | Python | gpl-3.0 | 4,180 |
#!/usr/bin/env python
"""
OctoKissUpload - Upload Gcode to Octoprint
Based on: https://github.com/quillford/OctoUpload
Todo
1: SSL support
"""
version = "0.01"
import sys
import os
import base64
import socket
import urllib
import urllib2
import mimetools
hostIP = '192.168.88.14'
octoPort = '5000'
apiKey = '7CC1581... | artekw/OctoKissUpload | OctoKissUpload.py | Python | mit | 3,278 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
parse_duration,
)
class MojvideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mojvideo\.com/video-(?P<display_id>[^/]+)/(?P<id>[a-f0-9]+)'
_TEST = {
... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/mojvideo.py | Python | unlicense | 2,093 |
#Es necesario cambiar estos datos por los parametros de nuestro servidor, usuarios, password
userDb = "userDb"
passDb = "passDb"
mail = "*********@gmail.com"
passMail = "passMail"
nameDb = "domotics_db"
urlDb = "urlDb"
serverPort = 8080
#Security Code Device
updateCode = "UPDATE device SET code = '%s' WHERE id = '%s... | PascualArroyo/Domotics | Server/myconfig.py | Python | gpl-2.0 | 9,785 |
"""
Tests for the InstructorService
"""
import json
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from courseware.models import StudentModule
from instructor.services import InstructorService
from instructor.tests.test_tools import ... | jazztpt/edx-platform | lms/djangoapps/instructor/tests/test_services.py | Python | agpl-3.0 | 3,469 |
# ====================================================================
# 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 re... | fnp/pylucene | test/test_TermRangeQuery.py | Python | apache-2.0 | 3,825 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from .forms import UserChangeForm, UserCreationForm
from .models import User
class UserAdmin(UserAdmin):
fieldsets = (
(None, {'fields': ('email', 'password')}),
... | asi-pwr/plns | plns/users/admin.py | Python | mit | 830 |
"""
Parallelization utilities
"""
from functools import reduce
import multiprocessing
class Sketch(object):
@staticmethod
def initializer(cls, *args):
"""
FIXME: use of global not really nice (possible root of mysterious issue for user)
"""
global sketch_constructor
d... | lgautier/mashing-pumpkins | src/parallel.py | Python | mit | 2,984 |
#!/usr/bin/python2.4
# Copyright (c) 2006-2008 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.
''' Toolbar preprocessing code. Turns all IDS_COMMAND macros in the RC file
into simpler constructs that can be understood by G... | meego-tablet-ux/meego-app-browser | tools/grit/grit/tool/toolbar_preprocess.py | Python | bsd-3-clause | 1,794 |
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import (
models,
)
| open-synergy/opnsynid-hr | hr_employee_employment_status/__init__.py | Python | agpl-3.0 | 163 |
#!/usr/bin/env python
# Modules
import sys
from classes.state import State
# Process input: parse and act according to verb and arguments
def process_input(state, data):
split = data.partition(' ')
instr = split[0]
args = split[2]
if instr == '':
return
elif instr == 'exit' or in... | thomasrussellmurphy/menachem | menachem.py | Python | gpl-3.0 | 3,977 |
'''
Created on 03.11.2013
@author: bernd
'''
if __name__ == '__main__':
import emLibrary.DataFile as emDF
from os import listdir
from os.path import isfile, join
import mysqldb.mysqldb as mysqldb
configFile = 'em.config'
mypath = '/home/bernd/git/EnergyMonitor/Messfiles/2013-11-26 ID 0'
... | frodo81/EnergyMonitor | InsertAll.py | Python | gpl-2.0 | 1,342 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import MySQLdb
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
class statistics_info:
def __init__(self):
self.num = 0
self.sum = 0.0
self.weeks = []
self.user_sum = [0 for i in range(7)]
class week_info:
... | antkillerfarm/antkillerfarm_crazy | python/ml/tc/tc0209.py | Python | gpl-3.0 | 6,167 |
#!/usr/bin/env python
#encoding: utf8
#
# Copyright 2009 Facebook
#
# 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 ap... | baiyang/haha-project | aha_web/aha.py | Python | gpl-2.0 | 2,822 |
# (C) British Crown Copyright 2011 - 2015, Met Office
#
# This file is part of cartopy.
#
# cartopy 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 3 of the License, or
# (at your option)... | dkillick/cartopy | lib/cartopy/mpl/gridliner.py | Python | lgpl-3.0 | 17,713 |
# -*- coding: utf-8 -*-
""" PolymorphicModel Meta Class
Please see README.rst or DOCS.rst or http://bserve.webhop.org/wiki/django_polymorphic
"""
import sys
import inspect
from django.db import models
from django.db.models.base import ModelBase
from manager import PolymorphicManager
from query import Polymorphic... | sdelements/django_polymorphic | polymorphic/base.py | Python | bsd-3-clause | 10,068 |
# Copyright (c) 2010 Advanced Micro Devices, 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: redistributions of source code must retain the above copyright
# notice, this list of conditions... | xiaoyaozi5566/GEM5_DRAMSim2 | src/cpu/testers/directedtest/RubyDirectedTester.py | Python | bsd-3-clause | 2,482 |
import sys, csv
FLOW_TYPES = {
#'PMU_AGG' : "/direct/agg/pmu/",
#'PMU_COM' : "/direct/com/pmu/",
#'AMI_AGG' : "/direct/agg/ami/",
#'AMI_COM' : "/direct/com/ami/",
'WAC' : "/power/wac/",
'PDC' : "/power/pdc/",
'BGD' : "/power/bgd/"
#'DATA' : "/overlay/com/subscription"... | nsol-nmsu/ns3-smartgrid | preproc-case39cyber-ip.py | Python | gpl-2.0 | 9,768 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 by Oscar Morante <oscar@morante.eu>
#
# 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... | qguv/config | weechat/plugins/python/biditext.py | Python | gpl-3.0 | 1,386 |
"""
@name: Modules/House/_test/test_house.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2013-2020 by D. Brian Kimmel
@license: MIT License
@note: Created on Apr 8, 2013
@summary: Test handling the information for a house.
Passed all 11 tests - DBK - 2020-01-27
"""
fr... | DBrianKimmel/PyHouse | Project/src/Modules/House/_test/test_house.py | Python | mit | 3,437 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | platformio/platformio-docs | _ext/redirects.py | Python | apache-2.0 | 4,047 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import bottle as app
@app.route('/<:re:(|data.json)>', method=['GET', 'POST'])
def index():
dollar_rate = float(app.request.forms.get('dollar_rate') or 50.0)
hours_per_day = int(app.request.forms.get('hours_per_day') or 2)
days_to_work = int(app.request.forms.get(... | ejelome/archaic | py/prodev-calc/server.py | Python | mit | 1,366 |
#!/usr/bin/env python
'''
Written by Dejanira Araiza Illan, January 2017
'''
import re
import os
passed = 0
failed = 0
checked = []
result=[]
for ii in range(10,51):
for num,line in enumerate(open(os.getcwd()'/home/da13683/temporary/data_diffseeds_table_pr/assertion1_'+str(ii)+'.txt','r')):
getdata = re.split("A... | robosafe/mc-vs-bdi | data/assertioncov_pr_table.py | Python | gpl-3.0 | 6,941 |
# -*- coding: utf-8 -*-
"""The Logical Volume Manager (LVM) file system implementation."""
import pyvslvm
# This is necessary to prevent a circular import.
import dfvfs.vfs.lvm_file_entry
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.lib import lvm
from dfvfs.path import lvm_path_spec
fro... | dc3-plaso/dfvfs | dfvfs/vfs/lvm_file_system.py | Python | apache-2.0 | 4,506 |
__all__ = ['setup', 'get_db']
from modelplus.store import redis_db, sqlite_db
store = None
def setup(params):
"""
'redis' : { host, port, db }
'sqlite' : { file }
'mysql' : { host, port, db }
'riak' : { host, port, bucket }
'mongodb' : { host, port, bucket }
""... | koblas/modelplus | modelplus/__init__.py | Python | mit | 552 |
import pytest
import py
import os
from _pytest.config import get_config, PytestPluginManager
from _pytest.main import EXIT_NOTESTSCOLLECTED
@pytest.fixture
def pytestpm():
return PytestPluginManager()
class TestPytestPluginInteractions:
def test_addhooks_conftestplugin(self, testdir):
testdir.makepyf... | youtube/cobalt | third_party/web_platform_tests/tools/pytest/testing/test_pluginmanager.py | Python | bsd-3-clause | 12,170 |
from lxml import etree
import datetime, re
import asyncio, aiohttp
NINTENDO_LOGIN_PAGE = "https://id.nintendo.net/oauth/authorize"
SPLATNET_CALLBACK_URL = "https://splatoon.nintendo.net/users/auth/nintendo/callback"
SPLATNET_CLIENT_ID = "12af3d0a3a1f441eb900411bb50a835a"
SPLATNET_SCHEDULE_URL = "https://splatoon.ninte... | plusreed/foxpy | plugins/utils/maps.py | Python | mit | 5,375 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Copyright (c) 2010-2019 Denis Machard
# This file is part of the extensive automation project
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Le... | dmachard/extensive-testing | src/ea/testexecutorlib/TestDataStorage.py | Python | lgpl-2.1 | 4,179 |
# Copyright (C) 2014 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 v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be us... | kudlav/dnf | tests/cli/commands/test_makecache.py | Python | gpl-2.0 | 4,524 |
from json import dumps, loads
from datetime import datetime
EPOCH = datetime.utcfromtimestamp(0)
ADAYINSECONDS = 24 * 3600
def jlencode(iterable):
if isinstance(iterable, (dict, str, unicode)):
iterable = [iterable]
return u'\n'.join(jsonencode(o) for o in iterable)
def jldecode(lineiterable):
... | kalessin/python-hubstorage | hubstorage/serialization.py | Python | bsd-3-clause | 714 |
# This code was originally contributed by Jeffrey Harris.
import datetime
import struct
from six.moves import winreg
from six import text_type
try:
import ctypes
from ctypes import wintypes
except ValueError:
# ValueError is raised on non-Windows systems for some horrible reason.
raise ImportError("Ru... | Maximilian-Reuter/SickRage-1 | lib/dateutil/tz/win.py | Python | gpl-3.0 | 10,943 |
# Copyright 2020 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, ... | googleapis/python-talent | samples/snippets/job_search_custom_ranking_search_test.py | Python | apache-2.0 | 854 |
import unittest
import tests
unittest.TextTestRunner(verbosity=2).run(tests.suite())
| JasonLai256/pyExpenses | run_test.py | Python | bsd-3-clause | 86 |
from keras.applications import imagenet_utils
from keras.applications import mobilenet
def dummyPreprocessInput(image):
image -= 127.5
return image
def getPreprocessFunction(preprocessType):
if preprocessType == "dummy":
return dummyPreprocessInput
elif preprocessType == "mobilenet":
... | SlipknotTN/Dogs-Vs-Cats-Playground | deep_learning/keras/lib/preprocess/preprocess.py | Python | mit | 511 |
# Copyright 2019 The Oppia 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 applicable ... | brianrodri/oppia | core/controllers/story_viewer.py | Python | apache-2.0 | 10,500 |
# -*- coding: utf-8 -*-
# Copyright(C) 2015 Baptiste Delpey
#
# This file is part of a weboob module.
#
# This weboob module 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 3 of the... | vicnet/weboob | modules/bnpcards/module.py | Python | lgpl-3.0 | 2,575 |
# -*- coding:utf-8 -*-
#
# Copyright © 2015 The Spyder Development Team
# Copyright © 2014 Gonzalo Peña-Castellanos (@goanpeca)
#
# Licensed under the terms of the MIT License
"""
Application entry point.
"""
# Standard library imports
import os
import sys
# Local imports
from conda_manager.utils.qthelpers import qa... | spyder-ide/conda-manager | conda_manager/app/main.py | Python | mit | 764 |
# Global Forest Watch API
# Copyright (C) 2013 World Resource Institute
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version... | wri/gfw-api | gfw/countries/countries.py | Python | gpl-2.0 | 8,785 |
from __future__ import absolute_import
import imp
import marshal
import os
import re
import sys
import warnings
try:
unicode
except NameError:
unicode = str
if sys.version_info[0] == 2:
from StringIO import StringIO
from StringIO import StringIO as BytesIO
else:
from io import BytesIO, StringIO... | catapult-project/catapult | telemetry/third_party/modulegraph/modulegraph/util.py | Python | bsd-3-clause | 3,262 |
import json
from corehq.apps.app_manager.tests.util import add_build, patch_default_builds
from corehq.apps.app_manager.util import add_odk_profile_after_build
from dimagi.utils.decorators.memoized import memoized
import os
import codecs
from django.test import TestCase
from corehq.apps.app_manager.models import Appli... | puttarajubr/commcare-hq | corehq/apps/app_manager/tests/test_app_manager.py | Python | bsd-3-clause | 6,881 |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 18 10:18:12 2017
@author: u64125
"""
import os
os.chdir(r'C:\mtpywin\mtpy') # change this path to the path where mtpy is installed
import os.path as op
from mtpy.modeling.modem import Model
from mtpy.modeling.modem import Data
from mtpy.modeling.modem import Covariance
fr... | MTgeophysics/mtpy | examples/scripts/ModEM_build_inputfiles.py | Python | gpl-3.0 | 5,315 |
import socket
import threading
bind_ip = ""
bind_port = 60007
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
server.listen(5)
print("[*] Listening on %s:%d" % (bind_ip, bind_port))
def handle_client(client_socket):
request = client_socket.recv(1024).decode()
p... | xieyajie/BackHatPython | backhatpython02/server-tcp.py | Python | apache-2.0 | 707 |
from urllib.parse import urlparse
import warnings
from django.contrib.sitemaps import Sitemap, views
from django.contrib.sites.shortcuts import get_current_site
from django.urls import reverse
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.http import Http404
from django.shortcuts import get... | unt-libraries/coda | coda/coda_mdstore/resourcesync.py | Python | bsd-3-clause | 5,178 |
# 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... | cshallue/models | research/lstm_object_detection/seq_dataset_builder_test.py | Python | apache-2.0 | 9,297 |
from p2pool.bitcoin import networks
PARENT = networks.nets['hawaiicoin']
SHARE_PERIOD = 10 # seconds
CHAIN_LENGTH = 12*60*60//10 # shares
REAL_CHAIN_LENGTH = 12*60*60//10 # shares
TARGET_LOOKBEHIND = 20 # shares
SPREAD = 30 # blocks
IDENTIFIER = '1f7c84911f8491c8'.decode('hex')
PREFIX = 'c8c81f1f94949191'.decode('hex'... | alexandrcoin/p2pooldoge-all | p2pool/networks/hawaiicoin.py | Python | gpl-3.0 | 730 |
import configparser
import ast
class Config(configparser.RawConfigParser):
_CONFIG_FILE=""
def load(self,file):
self._CONFIG_FILE = file
self.read(file)
def save(self):
with open(self._CONFIG_FILE, 'w') as configfile:
self.write(configfile)
def get(self,setting):
... | oschwab/dcss_stats | dcss_stats/core/_config.py | Python | unlicense | 778 |
# encoding: utf-8
"""
configuration.py
Created by Thomas Mangin on 2011-11-29.
Copyright (c) 2011-2013 Exa Networks. All rights reserved.
"""
# NOTE: reloading mid-program not possible
import os
import sys
import logging
import pwd
import math
import socket
import struct
_application = None
_config = None
_defaul... | david-farrar/exaproxy | lib/exaproxy/configuration.py | Python | bsd-2-clause | 10,172 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring comm... | lootr/netzob | netzob/test/src/test_netzob/test_Common/suite_Type.py | Python | gpl-3.0 | 2,410 |
# -*- coding: utf-8 -*-
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
# Teon Brooks <teon.brooks@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
# Joan Massich <mailsik@gmail.com>
#
# License: BSD (3-clause)
imp... | olafhauk/mne-python | mne/io/_digitization.py | Python | bsd-3-clause | 18,017 |
from typing import List, Pattern
from recognizers_text.utilities import RegExpUtility
from recognizers_text.extractor import Extractor
from recognizers_number.number.french.extractors import FrenchIntegerExtractor
from ...resources.french_date_time import FrenchDateTime
from ..extractors import DateTimeExtractor
from ... | matthewshim-ms/Recognizers-Text | Python/libraries/recognizers-date-time/recognizers_date_time/date_time/french/timeperiod_extractor_config.py | Python | mit | 3,112 |
# !/usr/bin/env python
# coding=utf-8
"""
Configuration for vcr samples.
"""
import logging
from baidubce.bce_client_configuration import BceClientConfiguration
from baidubce.auth.bce_credentials import BceCredentials
HOST = 'http://vcr.bj.baidubce.com'
AK = 'Fill AK here'
SK = 'Fill SK here'
logger = logging.getLogg... | baidubce/bce-sdk-python | sample/vcr/vcr_sample_conf.py | Python | apache-2.0 | 675 |
import PyQt5.QtWidgets as QtWidgets
import PyQt5.QtGui as QtGui
class Blink(QtWidgets.QGraphicsRectItem):
"""
Represents a shp file diagram background
"""
ZVALUE = -1000
def __init__(self, rect, parent=None):
super(Blink, self).__init__(rect, parent)
brush = QtGui.QBr... | GeoMop/GeoMop | src/LayerEditor/ui/gitems/blink.py | Python | gpl-3.0 | 423 |
"""
Example of creating a radar chart (a.k.a. a spider or star chart) [1]_.
Although this example allows a frame of either 'circle' or 'polygon', polygon
frames don't have proper gridlines (the lines are circles instead of polygons).
It's possible to get a polygon grid by setting GRIDLINE_INTERPOLATION_STEPS in
matplo... | bundgus/python-playground | matplotlib-playground/examples/api/radar_chart.py | Python | mit | 7,632 |
"""
These functions are used protectors to implement :ref:`scoping <auth-scopes>`.
"""
import re
#: A special scope item that implicitly encapsulates all other scope items
ANY = {"$^&#THISISGARBAGE#*@&@#$*@$&DFDF#&#@&@&##*&@DHJGDJH#@&*^@#*+crud"}
def normalize_scope_items(scopes, default_mode="r", raise_err=True):... | geniphi/findig | findig/tools/protector/scopeutil.py | Python | mit | 5,779 |
import os
import sys
import shutil
import logging
import codecs
import inspect
import re
from string import Template
from runner import check_output
_log = logging.getLogger('utils')
def safe_makedirs(path):
try:
os.makedirs(path)
except OSError, e:
# Ignore if it exists
if e.errno !... | lloydbadger/test | lib/build_pack_utils/utils.py | Python | apache-2.0 | 10,306 |
import magic
import pytest
import requests
import requests_mock
from flaky import flaky
from canteens import cafenero
from canteens.canteen import FISH, MEAT, VEGAN, VEGGIE
@pytest.fixture(scope='module')
def pdf_file():
html = cafenero.download_website()
link = cafenero.extract_dropbox_link(html)
tmpdir... | ekeih/OmNomNom | tests/test_cafenero.py | Python | agpl-3.0 | 6,361 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('patients', '0007_auto_20150915_1546'),
]
operations = [
migrations.AlterField(
model_name='patient',
name='maiden_name',
field=... | muccg/rdrf | rdrf/registry/patients/migrations/0008_auto_20150916_1518.py | Python | agpl-3.0 | 503 |
# smartmirror.py
# requirements
# requests, feedparser, traceback, Pillow
from Tkinter import *
import locale
import threading
import time
import requests
import json
import traceback
import feedparser
from PIL import Image, ImageTk
from contextlib import contextmanager
LOCALE_LOCK = threading.Lock()
ui_locale = ''... | ansgmlen/ai-mirror | python/sample.py | Python | mit | 3,396 |
# Copyright 2019 Roberto Fichera - Level Prime Srl
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import base64
from odoo import _, models
from odoo.exceptions import ValidationError
class WizardExportFatturapa(models.TransientModel):
_inherit = "wizard.export.fatturapa"
def updateAtt... | OCA/l10n-italy | l10n_it_fatturapa_out/wizard/wizard_export_fatturapa_regenerate.py | Python | agpl-3.0 | 2,357 |
import string
import regex
from collections import deque
from flanker.mime.message.headers import encodedword, parametrized
from flanker.mime.message.headers.wrappers import ContentType, WithParams
from flanker.mime.message.errors import DecodingError
from flanker.utils import to_unicode, is_pure_ascii
MAX_LINE_LENGTH... | glyph/flanker | flanker/mime/message/headers/parsing.py | Python | apache-2.0 | 3,323 |
from typing import List, Optional, Union
from great_expectations import DataContext
from great_expectations.core.batch import Batch, BatchRequest
from great_expectations.execution_engine.execution_engine import MetricDomainTypes
from great_expectations.rule_based_profiler.domain_builder import DomainBuilder
from great... | great-expectations/great_expectations | tests/test_fixtures/rule_based_profiler/plugins/my_custom_semantic_type_column_domain_builder.py | Python | apache-2.0 | 3,360 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gunan/tensorflow | tensorflow/python/autograph/operators/special_values.py | Python | apache-2.0 | 3,006 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
class Dream(models.Model):
user = models.ForeignKey(User)
date = models.DateField()
title = models.CharField(max_length=100)
content = models.TextField()
feedback = models.TextFiel... | kwailamchan/programming-languages | python/django/elf/dailydream/dailydream/dreams/models.py | Python | mit | 512 |
#!/usr/bin/python3
"""
Cleans-up Sphinx-only constructs (ie from README.rst),
so that *PyPi* can format it properly.
To check for remaining errors, install ``sphinx`` and run::
python setup.py --long-description | sed -file 'this_file.sed' | rst2html.py --halt=warning
"""
import re
import sys, io
def yie... | iSTB/python-schemata | rst_cleaner.py | Python | mit | 1,813 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import os
import sys
this_dir = os.path.dirname(os.path.abspath(__file__))
trunk_dir = os.path.split(this_dir)[0]
sys.path.insert(0,trunk_dir)
from ikol.config import Config
from ikol.directory import Directorio
config = Config()
def moveToDest(listfiles,dircache):
... | lokiteitor/ikol | test/moveTest.py | Python | gpl-2.0 | 1,301 |
#!/usr/bin/env python2.7
# 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 la... | murgatroid99/grpc | tools/interop_matrix/run_interop_matrix_tests.py | Python | apache-2.0 | 9,599 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright(c) 2013 Krister Hedfors
#
# Known bugs:
# Debian Squeeze, apt-get:ed python-gevent
# * some DNS queries for nonexistent hosts
# are not cancelled by -w, but takes a long time to complete.
#
__all__ = ['XInfoTool']
import sys
import os
impor... | kristerhedfors/xnet | xnet/tools/xinfo.py | Python | bsd-3-clause | 9,752 |
__author__ = 'phillip'
from abc import ABCMeta, abstractmethod
class MailReceiver:
__metaclass__ = ABCMeta
@abstractmethod
def connect(self, config):
pass
@abstractmethod
def can_create_folder(self):
"""True if this mail access protocol supports the creation of folders on the ser... | grafgustav/accessmail | src/Service/MailReceiver.py | Python | mit | 1,806 |
import os
from rsqueakvm import display, wrapper
from rsqueakvm.error import PrimitiveFailedError
from rsqueakvm.model.display import W_DisplayBitmap
from rsqueakvm.model.pointers import W_PointersObject
from rsqueakvm.model.variable import W_WordsObject
from rsqueakvm.primitives import expose_primitive, assert_class,... | HPI-SWA-Lab/RSqueak | rsqueakvm/primitives/input_output.py | Python | bsd-3-clause | 9,607 |
#Scratch_n_sketch fan demo app
from libs.board import *
s = scratch_n_sketch()
#auto connect scratch_n_sketch
s.connect()
s.backGroundColor(0, 0, 0)
s.textBackColor(0, 0, 0)
s.penColor(255, 255, 0)
s.setFont(Font.terminal)
for i in range(1000):
#get sensor data
s.getSensorData()
console(s.A1)
wait(50)
... | warefab/scratch-n-sketch | python/digital_out.py | Python | mit | 866 |
"""Add adminrealm to policies
Revision ID: 4d9178fa8336
Revises: e5cbeb7c177
Create Date: 2015-06-15 13:58:35.377862
"""
# revision identifiers, used by Alembic.
revision = '4d9178fa8336'
down_revision = 'e5cbeb7c177'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.exc import OperationalError, Progra... | privacyidea/privacyidea | migrations/versions/4d9178fa8336_.py | Python | agpl-3.0 | 963 |
#!/usr/bin/env python3
#pylint: disable=missing-docstring
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
... | nuclear-wizard/moose | python/chigger/tests/exodus/blocks/none.py | Python | lgpl-2.1 | 629 |
# This code allows one to use SWIG wrapped objects from weave. This
# code is specific to SWIG-1.3 and above where things are different.
# The code is basically all copied out from the SWIG wrapper code but
# it has been hand edited for brevity.
#
# Prabhu Ramachandran <prabhu_r@users.sf.net>
from __future__ imp... | beiko-lab/gengis | bin/Lib/site-packages/scipy/weave/swigptr2.py | Python | gpl-3.0 | 163,306 |
import networkx as nx
from EoN import *
import matplotlib.pyplot as plt
import numpy as np
import scipy
import random
from collections import defaultdict
colors = ['#5AB3E6', '#FF2000', '#009A80', '#E69A00', '#CD9AB3', '#0073B3', '#F0E442']
class TestSample:
@classmethod
def setup_class(cls):
print("... | springer-math/Mathematics-of-Epidemics-on-Networks | EoN/tests/test_from_joel.py | Python | mit | 39,523 |
"""
This file contains celery tasks for email marketing signal handler.
"""
import logging
import time
from celery import task
from django.core.cache import cache
from email_marketing.models import EmailMarketingConfiguration
from student.models import EnrollStatusChange
from sailthru.sailthru_client import Sailthru... | louyihua/edx-platform | lms/djangoapps/email_marketing/tasks.py | Python | agpl-3.0 | 13,582 |
"""Main product initializer
"""
from zope.i18nmessageid import MessageFactory
from uwosh.pfg.d2c import config
from Products.Archetypes import atapi
from Products.CMFCore import utils
from Products.CMFCore.permissions import setDefaultRoles
# Define a message factory for when this product is internationalised.
# Thi... | uwosh/uwosh.pfg_search | uwosh/pfg_search/__init__.py | Python | gpl-2.0 | 2,182 |
class Solution(object):
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
if num <= 1:
return True
l = 1
r = num / 2
while l < r:
m = l + (r - l) / 2
if m < num / m:
l = m + 1
... | hawkphantomnet/leetcode | ValidPerfectSquare/Solution.py | Python | mit | 401 |
import os
from unittest import TestCase
from foster.init import Init
class InitTestCase(TestCase):
def setUp(self):
root = os.path.join(os.path.dirname(__file__), 'frames', 'init')
self.target = os.path.join(root, 'package.py')
os.chdir(root)
def tearDown(self):
if os.path.i... | hugollm/foster | tests/init_tests.py | Python | mit | 831 |
LOOP_TAKEN = 101
LOOP_NOT_TAKEN = 20
"""
Tuples of:
* Test file name without extension
* Pre-loop code (if any)
* Loop condition
* Expected answer (20 loop not taken, 101 loop taken)
"""
condition_answer_pairs = [
# boolean true/false constants
("while_loop_with_constant_false_is_not_taken... | Valtis/YATCP | tests/programs/test_programs/generated_while_loop_condition_tests/_generate_tests.py | Python | gpl-2.0 | 13,324 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class FamilyHistory(models.Model):
_inherit = 'clv.family.history'
family_id = fields.Many2one(
comodel_name='clv... | CLVsol/clvsol_odoo_addons | clv_family_history/models/family.py | Python | agpl-3.0 | 931 |
import numpy as np
def get_data(params):
"""generates sinthetic dataset"""
#input size -> cnt_sequences, len_suqence, cnt_dimentsions
# transform into (seq_len, batch) x cnt_batches
assert params["problem"]["size"][0] % params["batch_size"] == 0
params["problem"]["len_sequence"] = params["problem"... | undertherain/benchmarker | benchmarker/kernels/bert_custom/data.py | Python | mpl-2.0 | 631 |
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 yo... | gangadhar-kadam/mic-erpnext | support/doctype/maintenance_schedule/maintenance_schedule.py | Python | agpl-3.0 | 12,625 |
#!/usr/bin/env python3
import random, os, sys
from subprocess import check_output
# first argument is the correct program
correct_program = "solution"
in_file = "test_gen.in"
for index in range(1,20):
in_str = ""
k = random.randint(1,1000000)
in_str += str(k)
in_str += "\n"
correct_out = ""
... | ArVID220u/judge | problems/uddaellerjamnt/test_generator.py | Python | mit | 759 |
#!/usr/bin/python
#
# This file is part of CONCUSS, https://github.com/theoryinpractice/concuss/,
# and is Copyright (C) North Carolina State University, 2015. It is licensed
# under the three-clause BSD license; see LICENSE.
#
from lib.util.memorized import memorized
from lib.graph.graph import Graph
# Calculate ... | nish10z/CONCUSS | lib/coloring/basic/trans_frater_augmentation.py | Python | bsd-3-clause | 1,365 |
# -*- coding: utf-8 -*-
##
## This file is part of SCOAP3.
## Copyright (C) 2014 CERN.
##
## SCOAP3 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... | Dziolas/scoap3-1 | bibsched_tasklets/bst_springer.py | Python | gpl-2.0 | 1,011 |
"""mascotas URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | w12n/mascotas | mascotas/urls.py | Python | mit | 764 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ShortenUrl'
db.create_table('leech_shortenurl', (
... | ritksm/leech | leech/migrations/0001_initial.py | Python | mit | 4,040 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.