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
from unittest.mock import patch, call from django.test import TestCase from .. decorators import cached_method class TestCachedMethodDecorator(TestCase): @classmethod def setUpTestData(cls): super(cls, TestCachedMethodDecorator).setUpTestData() # A Test class with a cached method. c...
tndatacommons/tndata_backend
tndata_backend/utils/tests/test_decorators.py
Python
mit
1,519
#!/usr/bin/env /usr/bin/python3 import os,yaml datamap = {} conf_p = os.getcwd()+"/"+"config.yaml" if os.path.isfile(conf_p): conf = open(conf_p) datamap = yaml.safe_load(conf) conf.close() else: print(("Configure file not found at %s") % conf_p ) exit(0) def get_plgconf(mod_name): return datamap["plugins"][m...
comword/xmppbot
config.py
Python
gpl-3.0
329
# # 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...
mistercrunch/airflow
airflow/providers/microsoft/azure/transfers/local_to_wasb.py
Python
apache-2.0
2,647
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
e-gob/plataforma-kioscos-autoatencion
scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/module_utils/iosxr.py
Python
bsd-3-clause
5,611
# Copyright (c) 2014-2019 The Khronos Group Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and/or associated documentation files (the "Materials"), # to deal in the Materials without restriction, including without limitation # the rights to use, copy, modify, m...
attilaz/bgfx
3rdparty/spirv-headers/include/spirv/unified1/spirv.py
Python
bsd-2-clause
43,923
from __future__ import absolute_import, unicode_literals # `None` and empty string aren't valid JSON but it's safer to include them as potential empty values. EMPTY_SERIALIZED_JSON_VALUES = (None, '', '[]', '{}')
gasman/wagtaildraftail
wagtaildraftail/validators.py
Python
mit
214
import math from datastructures.array import Array from util import between def recursive_matrix_chain(p, m, i, j): if i == j: return 0 m[i, j] = math.inf for k in between(i, j - 1): q = recursive_matrix_chain(p, m, i, k) + recursive_matrix_chain(p, m, k + 1, j) + p[i - 1] * p[k] * p[j] ...
wojtask/CormenPy
src/chapter15/textbook15_3.py
Python
gpl-3.0
961
# 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...
frreiss/tensorflow-fred
tensorflow/python/keras/optimizer_v2/optimizer_v2.py
Python
apache-2.0
58,624
''' Created on 25/1/2015 @author: USUARIO ''' if __name__ == '__main__': pass
rfedmi/reposdmpdos
davidmp/milton.py
Python
gpl-2.0
90
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-06-01 21:10 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('menu', '0007_menulink_weight'), ] operations = [ migrations.RemoveField( ...
IVaN4B/maugli
maugli/menu/migrations/0008_remove_menulink_weight.py
Python
gpl-3.0
388
#!/usr/bin/env python # # ----------------------------------------------------------------------------- # Copyright (C) 2015 Daniel Standage <daniel.standage@gmail.com> # # This file is part of tag (http://github.com/standage/tag) and is licensed # under the BSD 3-clause license: see LICENSE. # ------------------------...
standage/tag
tag/__init__.py
Python
bsd-3-clause
1,438
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2016, Cumulus Networks <ce-ceng@cumulusnetworks.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_versio...
hryamzik/ansible
lib/ansible/modules/network/cumulus/_cl_ports.py
Python
gpl-3.0
2,580
from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User, Group from optparse import make_option from sys import stdout from csv import writer FORMATS = [ 'address', 'google', 'outlook', 'linkedin', 'vcard', ] def full_name(first_name, last_nam...
waseem18/oh-mainline
vendor/packages/django-extensions/django_extensions/management/commands/export_emails.py
Python
agpl-3.0
4,801
""" Client for communicating with a cmdserver. """ import requests import logging from common import RpcException logger = logging.getLogger(__name__) class CmdClient(object): def __init__(self, user, host, port): self.user = user self.host = host self.port = port def check(self): ...
anpere/goaway
goaway/cmdclient.py
Python
mit
2,032
# does this even work? class InvalidToken(Exception, object): """Raise an invalid token """ def __init__(self, message, payload): super(InvalidToken, self).__init__(message, payload) self.message = message self.payload = payload
kovarus/vmworld-us-hackathon-2017
vrealize-pysdk/vralib/vraexceptions.py
Python
apache-2.0
261
from atlassian import Bitbucket url = "http://localhost:7990" username = "admin" password = "admin" proj = "PROJ" repo = "test-repo" pr_id = 123 bitbucket = Bitbucket(url=url, username=username, password=password, advanced_mode=True) diff = bitbucket.get_pull_requests_changes(proj, repo, pr_id).json() for item in d...
AstroTech/atlassian-python-api
examples/bitbucket/bitbucket_pullrequest_get_changed_files.py
Python
apache-2.0
391
import os from pkg_resources import resource_filename import time import arcpy import numpy import nose.tools as nt import numpy.testing as nptest import tidegates.testing as tgtest import mock import tidegates from tidegates import utils @nt.nottest class MockResult(object): def __init__(self, path): ...
Geosyntec/python-tidegates
tidegates/tests/test_utils.py
Python
bsd-3-clause
41,033
#!/usr/bin/env python """ Read in the time and temperature data for the transient HRR example. """ import numpy as np # Read in experimental data from file data = np.genfromtxt('../Experimental_Data/time_temperature_data.csv', delimiter=',', names=True) # Set data variables time = data['time']...
koverholt/bayes-fire
Example_Cases/CFAST_Transient_HRR/Scripts/data_cfast_transient.py
Python
bsd-3-clause
355
import RPIO.PWM as PWM import time from flask import Flask, url_for, request import commands #variable app = Flask(__name__) app.config.from_object(__name__) GPIO_RED = 17 GPIO_GREEN = 27 GPIO_BLUE = 22 Correction_RED = 1.0 Correction_GREEN = 1.0 Correction_BLUE = 1.0 Correction_RED1 = 1.0 Correction_GREEN1 = 1.0 Corr...
davidecaminati/Domotics-Raspberry
Hardware/Color_LED/fade.py
Python
lgpl-3.0
2,645
''' Created on Jan 21, 2010 @author: nayeem ''' import pyvision as pv import numpy as np import scipy as sp from pyvision.vector.SVM import SVM import csv import os.path import sys sys.setrecursionlimit(1500) class multiSVM: ''' classdocs ''' def __init__(self): ''' Constructor ...
tigerking/pyvision
src/pyvision/data/ml/mulSVM.py
Python
bsd-3-clause
5,495
""" See the NOTICE file distributed with this work for additional information regarding copyright ownership. 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/LICEN...
Ensembl/ensembl-compara
src/python/lib/ensembl/compara/filesys/dircmp.py
Python
apache-2.0
8,473
# -*- coding: utf-8 -*- """ Created on Tue Nov 1 10:53:38 2016 @author: nwillemse """ from datetime import datetime from sqlalchemy import (Integer, Column, String, Float, DateTime, Time, BigInteger, ForeignKey, UniqueConstraint) from sqlalchemy.orm import relationship from ..sqlite_db import ...
nwillemse/nctrader
nctrader/price_handler/sqlite_db/models.py
Python
mit
6,079
''' Test proxy serving stale content when DNS lookup fails ''' # 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 un...
duke8253/trafficserver
tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py
Python
apache-2.0
3,341
# -*- mode: python; coding: utf-8 -*- # Copyright (C) 2017 Laboratoire de Recherche et Développement # de l'Epita # # This file is part of Spot, a model checking library. # # Spot 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 S...
mcc-petrinets/formulas
spot/tests/python/toweak.py
Python
mit
2,094
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Python Intro documentation build configuration file, created by # sphinx-quickstart on Sat Jul 18 07:40:48 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this...
birlorg/pythonTutorial
conf.py
Python
bsd-2-clause
11,512
"""Fix function attribute names (f.func_x -> f.__x__).""" # Author: Collin Winter # Local imports from .. import fixer_base from ..fixer_util import Name class FixFuncattrs(fixer_base.BaseFix): PATTERN = """ power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' ...
babyliynfg/cross
tools/project-creator/Python2.6.6/Lib/lib2to3/fixes/fix_funcattrs.py
Python
mit
638
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-09-21 10:43 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('flow', '0003_data_dependency_1'), ] operations = [...
jberci/resolwe
resolwe/flow/migrations/0004_data_dependency_2.py
Python
apache-2.0
1,201
# -*- coding: utf-8 -*- # # Picard, the next-generation MusicBrainz tagger # Copyright (C) 2007 Lukáš Lalinský # # 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...
dufferzafar/picard
picard/const/__init__.py
Python
gpl-2.0
3,754
""" This file contains defines parameters for nipy that we use to fill settings in setup.py, the nipy top-level docstring, and for building the docs. In setup.py in particular, we exec this file, so it cannot import nipy """ # nipy version information. An empty _version_extra corresponds to a # full release. '.dev...
FredLoney/nipype
nipype/info.py
Python
bsd-3-clause
4,915
from __future__ import absolute_import from mock import patch from datadog.util.hostname import get_hostname from sentry.metrics.datadog import DatadogMetricsBackend from sentry.testutils import TestCase class DatadogMetricsBackendTest(TestCase): def setUp(self): self.backend = DatadogMetricsBackend(pr...
Kryz/sentry
tests/sentry/metrics/test_datadog.py
Python
bsd-3-clause
979
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from shimehari.testsuite import ShimehariTestCase from shimehari.configuration import ConfigManager, Config class TestConfigManager(ShimehariTestCase): def testHasNotConfig(self): ConfigManager.configrations = {} rv = ConfigManager.has...
glassesfactory/Shimehari
shimehari/testsuite/test_configuration.py
Python
bsd-3-clause
1,575
from math import sqrt, cos, sin, fabs from opencmiss.zincwidgets.sceneviewerwidget import SceneviewerWidget import time time_0 = time.time() initial_view = [[49.79080069116709, 588.9318153465964, -363.0583058231066], [2.285999298095703, -71.78712940216064, -44.651397705078125], [0.02...
ABI-Software/MedTechCoRE-Pelvis
src/medtechcore/pelvisdemo/widgets/pelvisviewerwidget.py
Python
apache-2.0
7,286
import urllib from urllib.parse import urlparse def build_url(base_url, path, args_dict=None): # Returns a list in the structure of urlparse.ParseResult url_parts = list(urlparse(base_url)) url_parts[2] = path if args_dict is not None: url_parts[4] = urllib.parse.urlencode(args_dict) retur...
sensidev/drf-requests-jwt
drf_requests_jwt/backends/utils.py
Python
mit
357
# (c) 2013, Ovais Tariq <me@ovaistariq.net> # # This file is part of mha_helper # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later...
ovaistariq/mha-helper
mha_helper/__init__.py
Python
gpl-3.0
900
# -*- coding: utf-8 -*- # Copyright 2015 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Unit tests for the deploy module.""" from __future__ import print_function import json import multiprocessing import os impor...
endlessm/chromium-browser
third_party/chromite/cli/deploy_unittest.py
Python
bsd-3-clause
17,192
from django.core.exceptions import ImproperlyConfigured from django.shortcuts import get_object_or_404 from django.utils.encoding import force_text from . import utils class TenantViewMixin(object): """Mixin for generic class-based views to handle tenant-enabled objects. Use with: * ListView ...
caktus/rapidsms-decisiontree-app
decisiontree/multitenancy/views.py
Python
bsd-3-clause
2,928
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
alxgu/ansible
lib/ansible/modules/identity/ipa/ipa_role.py
Python
gpl-3.0
10,522
import os import signal import time def signal_usr1(signum, frame): "Callback invoked when a signal is received" pid = os.getpid() print('Received USR1 in process {}'.format(pid)) print('Forking...') child_pid = os.fork() if child_pid: print('PARENT: Pausing before sending signal...') time.sleep...
jasonwee/asus-rt-n14uhp-mrtg
src/lesson_runtime_features/os_kill_example.py
Python
apache-2.0
580
import re from wtforms import validators def validatorCorreo(form, field): if not re.match('\w+@(\w+)\.com|es',field.data): raise validators.ValidationError('Esto no es un correo electronico') def validatorVISA(form, field): if not re.match('(((\d{4}-){3})|((\d{4} ){3}))\d{4}',field.data): rais...
araluce/NextMedia
NextMedia/validators.py
Python
gpl-3.0
538
""" Translation rules for the Surrey Roads. Copyright 2011 Paul Norman. """ def translateName(rawname): suffixlookup = {} suffixlookup.update({'Ave':'Avenue'}) suffixlookup.update({'Rd':'Road'}) suffixlookup.update({'St':'Street'}) suffixlookup.update({'Pl':'Place'}) suffixlookup.update({'Cr':'Cr...
runetvilum/skolevej
ogr2osm/translations/surreyroad.py
Python
gpl-3.0
3,944
import attr import pandas as pd import re from ..base import TohuBaseGenerator from ..logging import logger __all__ = ['get_tohu_items_name', 'make_tohu_items_class'] def make_tohu_items_class(clsname, attr_names): """ Parameters ---------- clsname: string Name of the class to be created ...
maxalbert/tohu
tohu/v6/custom_generator/utils.py
Python
mit
3,014
#!/usr/bin/python """soql2atom: a beatbox demo that generates an atom 1.0 formatted feed of any SOQL query (requires beatbox 0.9 or later) The fields Id, SystemModStamp and CreatedDate are automatically added to the SOQL if needed. The first field in the select list becomes the title of the entry, so make sure ...
lexsf/Beatbox
soql2atom.py
Python
gpl-2.0
5,463
# jsb/plugs/socket/dns.py # # """ do a fqdn loopup. """ ## jsb imports from jsb.lib.commands import cmnds from jsb.lib.examples import examples ## basic imports from socket import gethostbyname from socket import getfqdn import re ## dns command def handle_dns(bot, event): """ arguments: <ip>|<hostname> - do...
Petraea/jsonbot
jsb/plugs/socket/dns.py
Python
mit
1,189
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import abc from typing import Tuple import numpy as np class Acquisition(abc.ABC): """Acquisition base class""" def __add__(self, other: "Acquisition") -> "Sum": """ Overloads se...
EmuKit/emukit
emukit/core/acquisition/acquisition.py
Python
apache-2.0
8,967
from datetime import date, datetime from io import StringIO import ibis import ibis.common.exceptions as com import ibis.expr.operations as ops import ibis.expr.types as ir import ibis.util as util from .identifiers import quote_identifier def _cast(translator, expr): from .client import ClickhouseDataType ...
cloudera/ibis
ibis/backends/clickhouse/registry.py
Python
apache-2.0
19,994
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
diogocs1/comps
web/addons/account_voucher/account_voucher.py
Python
apache-2.0
83,973
print "Happy New Year"
alihesari/Happy-New-Year
happy-new-year.py
Python
mit
22
import logging import os from contextlib import contextmanager LOG_FORMAT = "%(name)s.%(module)s.%(funcName)s: %(message)s" def enable_logging(): logging.basicConfig( level=logging.DEBUG, format=LOG_FORMAT, ) # Allow from-the-start debugging (vs toggled during load of tasks module) via # she...
frol/invoke
invoke/util.py
Python
bsd-2-clause
879
import _plotly_utils.basevalidators class CustomdatasrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__(self, plotly_name="customdatasrc", parent_name="pointcloud", **kwargs): super(CustomdatasrcValidator, self).__init__( plotly_name=plotly_name, parent_name=paren...
plotly/python-api
packages/python/plotly/plotly/validators/pointcloud/_customdatasrc.py
Python
mit
459
# proxy module from __future__ import absolute_import from chaco.function_data_source import *
enthought/etsproxy
enthought/chaco/function_data_source.py
Python
bsd-3-clause
95
# Copyright (c) 2014 VMware, 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...
bswartz/cinder
cinder/tests/unit/test_vmware_datastore.py
Python
apache-2.0
15,364
# -*- encoding: utf-8 -*- """ Customizes party address to have address in correct format for Endicia API . """ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. import string from endicia import FromAddress, ToAddress from t...
fulfilio/trytond-shipping-endicia
party.py
Python
bsd-3-clause
2,854
from django.core.urlresolvers import reverse from django.db import models class Tag(models.Model): name = models.CharField(max_length=64, unique=True) TYPES = ( ('gen', 'Generic'), ('char', 'Character'), ('meta', 'Meta'), ('dang', 'Dangerous'), ) type = models.CharField(max_length=4, choices=TYPES, defau...
PrincessTeruko/TsunArt
tags/models.py
Python
mit
575
from io import BytesIO from jawa.cf import ClassFile from jawa.attributes.source_file import SourceFileAttribute def test_sourcefile_read(loader): """ Ensure we can read a SourceFileAttribute generated by javac. """ cf = loader['HelloWorldDebug'] source_file = cf.attributes.find_one(name='SourceF...
TkTech/Jawa
tests/attributes/test_sourcefile_attribute.py
Python
mit
925
import pandas as pd import numpy as np import scipy as sp datafolder = '/home/eliezer/datasets/hetrec2011/lastfm/' datafolder = '/home/eliezer/datasets/hetrec2011/lastfm/' from experiment_util import LoadLastFM loader=LoadLastFM(datafolder) loader.load() R = loader.mat_users_artists_train.T W = loader.mat_artists_tag...
zehsilva/poissonmf_cs
scripts/test_load.py
Python
mit
518
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0001_initial'), ] operations = [ migrations.CreateModel( name='Task', fields=[ ...
mysociety/pombola
pombola/tasks/migrations/0001_initial.py
Python
agpl-3.0
2,017
#!/usr/bin/env python import random '''\ The computer will pick a number between 1 and 100. (You can choose any high number you want.) The purpose of the game is to guess the number the computer picked in as few guesses as possible. source:http://openbookproject.net/pybiblio/practice/\ ''' high_or_low = {True: "Too ...
CompSoc-NUIG/python_tutorials_2013
guess.py
Python
unlicense
774
# Mini-project #6 - Blackjack import simplegui import random # load card sprite - 936x384 - source: jfitz.com CARD_SIZE = (72, 96) CARD_CENTER = (36, 48) card_images = simplegui.load_image("http://storage.googleapis.com/codeskulptor-assets/cards_jfitz.png") CARD_BACK_SIZE = (72, 96) CARD_BACK_CENTER = (36, 48) card_...
ZethernDev/blackjack
old_code.py
Python
mit
3,559
#!/usr/bin/env python # -*- coding: utf-8 -*- """simple parser / string tokenizer rather than returning a list of token types etc, we simple return a list of tokens. Each tokenizing function takes a string as input and returns a list of tokens. """ # Copyright 2002, 2003 St James Software # # This file is part of tr...
staranjeet/fjord
vendor/packages/translate-toolkit/translate/misc/sparse.py
Python
bsd-3-clause
7,986
# Copyright 2013 IBM Corp. # # 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 agree...
ntt-sic/nova
nova/objects/service.py
Python
apache-2.0
5,687
#!/usr/bin/env python # Copyright (c) 2003-2006 ActiveState Software Inc. # # The MIT License # # 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 limita...
f304646673/PhpDebugger
src/dbgp/listcmd.py
Python
apache-2.0
12,414
#!/usr/bin/env python # Copyright (C) 2013 Google 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 ...
zero-rp/miniblink49
third_party/WebKit/Source/build/scripts/make_element_lookup_trie.py
Python
apache-2.0
5,298
# -*- encoding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the...
InakiZabala/odoomrp-wip
procurement_purchase_forecast/wizard/purchase_forecast_load.py
Python
agpl-3.0
8,835
#!/usr/bin/env python from setuptools import setup version = '0.0.1' setup( name='foursquare.pants.changed', author='Foursquare', author_email='pants@foursquare.com', description='List, build or test locally changed targets', url = 'https://github.com/foursquare/pants-changed', version=version, download...
foursquare/pants-changed
setup.py
Python
apache-2.0
661
# # Autor: Igor Nunes # Materia: Programa Python # Orientador : Ronaldo # Aula de Banco Basico Delete # import mysql.connector config = { 'host':'localhost', 'port': 3306, 'database':'LojaDB', 'user':'admin', 'password':'admin' } db = mysql.connector.connector(**config) cur...
ronas/PythonGNF
Igor/BancoDadosDelete.py
Python
gpl-3.0
548
""" Collection of helper classes and functions to reduce boilerplate code. """ from .fields import * from .flatten import FlattenedAccess from .serialization import Serializable, FrozenSerializable, SimpleJsonEncoder, encode from .hparams import HyperParameters try: from .serialization import YamlSerializable exce...
lebrice/SimpleParsing
simple_parsing/helpers/__init__.py
Python
mit
450
# -*- coding: utf-8 -*- from odoo import fields, models class Notification(models.Model): _inherit = 'mail.notification' notification_type = fields.Selection(selection_add=[('snail', 'Snailmail')], ondelete={'snail': 'cascade'}) letter_id = fields.Many2one('snailmail.letter', string="Snailmail Letter", ...
jeremiahyan/odoo
addons/snailmail/models/mail_notification.py
Python
gpl-3.0
719
"""Definition of the SimpleContact content type """ from zope.interface import implements, directlyProvides from Products.Archetypes import atapi from Products.ATContentTypes.content import base from Products.ATContentTypes.content import schemata from vwcollective.simplecontact import simplecontactMessageFactory as...
vwc/agita
src/vwcollective.simplecontact/vwcollective/simplecontact/content/simplecontact.py
Python
mit
4,207
# pointer variables are : v0=4, v1=5, v2=6, v3=7, v4=8, x=1, y=2, z=3 # next pointers are : left=0, parrent=2, right=1 # data values are : 0="00000001" def get_program(): program=[ ("ifx==null","00000000",1,5,1), ("ifx==null","00000001",2,5,2,"NOABSTR"), ("x=y.next","00000010",4,1,1,3,"NOABS...
marusak/C2ARTMC
tests/test_dirs/complex_expression/expected_program.py
Python
gpl-3.0
1,584
# This is a copy of fetch/api/resources/echo-content.py since it's more # convenient in this directory due to service worker's path restriction. def main(request, response): headers = [("X-Request-Method", request.method), ("X-Request-Content-Length", request.headers.get("Content-Length", "NO")), ...
anthgur/servo
tests/wpt/web-platform-tests/service-workers/service-worker/resources/echo-content.py
Python
mpl-2.0
578
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_python-boilerplate ---------------------------------- Tests for `python-boilerplate` module. """ import unittest from python-boilerplate import python-boilerplate class TestPython-boilerplate(unittest.TestCase): def setUp(self): pass def tes...
jlant/playground
python/hello-cookiecutter/python-boilerplate/tests/test_python-boilerplate.py
Python
mit
438
from django import forms from django.contrib import admin from django.contrib.admin.util import unquote from django.conf.urls.defaults import patterns, url from django.contrib.contenttypes import generic from django.core import mail from django.core.context_processors import csrf from django.core.urlresolvers import re...
nickburlett/pennyblack
pennyblack/models/job.py
Python
bsd-3-clause
14,888
import math import torch from .Module import Module class TemporalConvolution(Module): def __init__(self, inputFrameSize, outputFrameSize, kW, dW=1): super(TemporalConvolution, self).__init__() self.inputFrameSize = inputFrameSize self.outputFrameSize = outputFrameSize self.kW = ...
RPGOne/Skynet
pytorch-master/torch/legacy/nn/TemporalConvolution.py
Python
bsd-3-clause
1,969
from os import urandom from random import seed, choice import lib.args @lib.args.convert(n=int) def new(n, forbidden=''): seed(urandom(n)) allowed = "azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN`!$%^&*()_+-=;,./<>?1234567890'\"§èçé#@|{}àùµ" symbols = list(frozenset(allowed) - frozenset(forbidd...
aureooms/sak
sak/password.py
Python
agpl-3.0
679
import os import github3 import pytest from github3 import repos from tests.utils import (BaseCase, load, mock) class TestRepository(BaseCase): def __init__(self, methodName='runTest'): super(TestRepository, self).__init__(methodName) self.repo = repos.Repository(load('repo')) def setUp(self)...
ueg1990/github3.py
tests/test_repos.py
Python
bsd-3-clause
25,952
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Description - 获取IP代理。 Info - author : "moran" - github : "moranzcw@gmail.com" - date : "2017.7.29" """ __author__ = """\ /\/\ ___ _ __ __ _ _ __ / \ / _ \| '__/ _` | '_ \ / /\/\ \ (_) | | | (_| | | | | \/ \/\___/|_| \__,_|_| |_|""" # 代理服务器 proxyHost ...
moranzcw/Zhihu-Spider
spider/proxy.py
Python
mit
697
# -*- coding: utf-8 -*- """ requests.cookies ~~~~~~~~~~~~~~~~ Compatibility code to be able to use `cookielib.CookieJar` with requests. requests.utils imports from here, so be careful with imports. """ import copy import time import calendar import collections from ._internal_utils import to_native_string from .co...
momm3/WelcomeBot
welcomebot/Lib/site-packages/requests/cookies.py
Python
mit
18,208
###################################################################### ## ## Copyright (C) 2006, Blekinge Institute of Technology ## ## Filename: SyscallGenerator.py ## Author: Simon Kagstrom <ska@bth.se> ## Description: System call generators ## ## $Id: syscallgenerator.py 14099 2007-03-10 07:51:59Z ska...
SimonKagstrom/cibyl
tools/python/Cibyl/SyscallHandling/syscallgenerator.py
Python
lgpl-2.1
10,603
from direct.distributed.DistributedNodeAI import DistributedNodeAI from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.fsm import StateData from toontown.safezone import DistributedChineseCheckersAI from toontown.safezone import DistributedChecke...
ksmit799/Toontown-Source
toontown/safezone/DistributedPicnicTableAI.py
Python
mit
10,737
from pybloqs.block.base import BaseBlock from pybloqs.block.convenience import Block class Box(BaseBlock): def __init__(self, contents, **kwargs): """ Wrap the supplied content (can be anything that is supported by the basic blocks) in a container. :param contents: Content to wra...
manahl/PyBloqs
pybloqs/block/wrap.py
Python
lgpl-2.1
973
# Django settings for dj_apache project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = '' # Or path to database file if...
lluxury/P_U_S_A
11_gui/dj_apache/settings.py
Python
mit
2,849
# Copyright 2019-2020 by Christopher C. Little. # This file is part of Abydos. # # Abydos 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 versio...
chrislit/abydos
tests/distance/test_distance_cohen_kappa.py
Python
gpl-3.0
3,238
## ## Copyright(c) 2009 Syntext, Inc. All Rights Reserved. ## Contact: info@syntext.com, http://www.syntext.com ## ## This file is part of Syntext Serna XML Editor. ## ## COMMERCIAL USAGE ## Licensees holding valid Syntext Serna commercial licenses may use this file ## in accordance with the Syntext Serna Commercial...
malaterre/serna-free-backup
serna/dist/plugins/syntext/element-help/py/element-help.py
Python
gpl-3.0
3,379
# -*- coding: utf-8 -*- # (c) 2016-2017 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> import cgi import json import logging from contextlib import contextmanager from pyramid.httpexceptions import HTTPError from pyramid.response import Response log = logging.getLogger(__name__) class GenericAdapterException(Except...
ip-tools/ip-navigator
patzilla/access/generic/exceptions.py
Python
agpl-3.0
2,020
# encoding:utf-8 # # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2009 Benny Malengier # Copyright (C) 2009 Douglas S. Blank # Copyright (C) 2009 Nick Hall # Copyright (C) 2011 Tim G L Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Gener...
Nick-Hall/gramps
gramps/plugins/view/view.gpr.py
Python
gpl-2.0
8,582
# 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): # Adding field 'Project.on_homepage' db.add_column('storybase_user_project', 'on_homepage', self.gf('djang...
denverfoundation/storybase
apps/storybase_user/migrations/0008_auto__add_field_project_on_homepage__add_field_organization_on_homepag.py
Python
mit
20,050
import unittest from unittest.mock import patch from django import forms from django.conf import settings from django.shortcuts import resolve_url from django.test import TestCase from django.urls import reverse from .utils import UserMixin try: from otp_yubikey.models import ValidationService, RemoteYubikeyDevi...
Bouke/django-two-factor-auth
tests/test_yubikey.py
Python
mit
5,356
"""Imports new symbols.""" import os import tokenize from collections import defaultdict try: from ConfigParser import ConfigParser except: from configparser import ConfigParser from importmagic.six import StringIO class Iterator(object): def __init__(self, tokens, start=None, end=None): self._t...
TeamSPoon/logicmoo_workspace
packs_web/butterfly/lib/python3.7/site-packages/importmagic/importer.py
Python
mit
12,592
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # Copyright (c) 2008-2021 pyglet contributors # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follo...
calexil/FightstickDisplay
pyglet/media/codecs/ffmpeg_lib/__init__.py
Python
gpl-3.0
1,916
#! /usr/bin/env python3 # -*- coding: UTF-8 -*- import json from unittest import TestCase, main from tornado.gen import coroutine from tornado.escape import url_escape from tornado.testing import AsyncHTTPTestCase, gen_test import calculator_api as ca class TestOperations(TestCase): def assertNumReduceOperatio...
cganterh/tornado_calculator_api
test_calculator_api.py
Python
gpl-2.0
5,442
# # Copyright (C) 2013 UNINETT # # This file is part of Network Administration Visualized (NAV). # # NAV is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by # the Free Software Foundation. # # This program is distributed in the hope th...
alexanderfefelov/nav
python/nav/ipdevpoll/plugins/statsensors.py
Python
gpl-2.0
3,216
# Test the signal module from test_support import verbose, TestSkipped import signal import os import sys if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos': raise TestSkipped, "Can't test signal on %s" % sys.platform if verbose: x = '-x' else: x = '+x' pid = os.getpid() # Shell script that ...
neopoly/rubyfox-server
lib/rubyfox/server/data/lib/Lib/test/test_signal.py
Python
mit
1,460
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import copy # Define a collection of group_by functions GROUP_BY_MAP = {} def group_by(name): def wrapper(func)...
mozilla-mobile/focus-android
taskcluster/focus_android_taskgraph/loader/__init__.py
Python
mpl-2.0
1,789
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file './Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.ui' # # Created: Tue Nov 18 17:53:57 2014 # by: PyQt5 UI code generator 5.3.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_...
davy39/eric
Plugins/VcsPlugins/vcsMercurial/Ui_HgDiffDialog.py
Python
gpl-3.0
5,660
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public tr...
VincentCATILLON/navitia
source/jormungandr/tests/check_utils.py
Python
agpl-3.0
25,565
"""Multi-layer Perceptron """ # Authors: Issam H. Laradji <issam.laradji@gmail.com> # Andreas Mueller # Jiyuan Qian # License: BSD 3 clause import numpy as np from abc import ABCMeta, abstractmethod import warnings import scipy.optimize from ..base import BaseEstimator, ClassifierMixin, Regressor...
bnaul/scikit-learn
sklearn/neural_network/_multilayer_perceptron.py
Python
bsd-3-clause
56,734
#!/usr/bin/env python # Copyright 2016 VMware, 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 ...
BaluDontu/docker-volume-vsphere
esx_service/vol_test.py
Python
apache-2.0
4,800
#!/usr/bin/env python import subprocess short_name = 'Opt 3' disp_name = 'Option 3 Submenu' otype = 'Routine' need = ['need 1: ', 'need 2: ', 'need 3: '] answers = [] def run(): global answers while True: subprocess.call('clear') i = 0 while i < len(need): ans = input(need[i]) if validate(ans): ans...
kbknapp/ConsoleMenu-py3x
examples/menu/opt3.py
Python
gpl-2.0
532
from django.shortcuts import render from django.views.generic import ListView, DetailView from django.views.generic import FormView, TemplateView from .models import Player from .forms import PlayerForm # Create your views here. class HomePage(TemplateView): template_name = 'players/index.html' class PlayerList(...
biddellns/litsl
players/views.py
Python
gpl-3.0
675
# -*- coding: utf-8 -*- # Dojima, a markets client. # Copyright (C) 2012 Emery Hemingway # # 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)...
choperlizer/Dojima
dojima/ui/ot/contract.py
Python
gpl-3.0
5,531