code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
import urllib import requests from .exceptions import DocTypeException, DocIDException from .settings import * def validate_doc_type(doc_type): """Make sure the provided doc_type is supported """ try: DOC_TYPES.index(doc_type) except ValueError: raise DocTypeException def valida...
AxisPhilly/py-li
li/utils.py
Python
mit
3,627
import numpy as np import scipy.optimize as op from .nncostFunction import getCost, getGrad def optimize(X, y, theta): Result = op.minimize(fun = getCost, x0 = theta, args=(X, y), method='TNC', jac= getGrad, options={'maxiter': 400}) return Result.x
pk-ai/training
machine-learning/coursera_exercises/ex4/in_python/exercises/advOptimze.py
Python
mit
257
''' Created on Jun 16, 2015 @author: theo ''' from django.contrib import admin from django import forms from django.forms import Textarea from django.contrib.gis.db import models from models import UserProfile, Adres, Waarnemer, Meetpunt, Organisatie, AkvoFlow, CartoDb, Waarneming, Phone from acacia.data.models import...
acaciawater/iom
iom/admin.py
Python
apache-2.0
11,264
#!/usr/bin/env python import argparse import gzip import logging import os import shutil import subprocess browser_specific_args = { "firefox": ["--install-browser"] } def tests_affected(commit_range): output = subprocess.check_output([ "python", "./wpt", "tests-affected", "--null", commit_range ...
jimberlage/servo
tests/wpt/web-platform-tests/tools/ci/taskcluster-run.py
Python
mpl-2.0
3,009
invalid_syntax(
neomake/neomake
tests/fixtures/errors.py
Python
mit
16
""" An abstract representation of NetCDF data for manipulation purposes. The purpose of this is to allow arbitrary manipulation of NetCDF data, decoupled from the netCDF4 file-based API. For example:: import ncobj.nc_dataset as ncds with netCDF4.Dataset(file_in_path) as ds_in: in_group = ncds.read(ds...
pp-mo/ncobj
lib/ncobj/__init__.py
Python
gpl-3.0
19,019
# BASE CACHE KEYS IMAGE_PREVIEW_CACHE = "image.preview." RENDERED_CONTENT_CACHE = "rendered.content."
alirizakeles/tendenci
tendenci/apps/base/cache.py
Python
gpl-3.0
101
from pprint import pformat class Model(object): """ Implements a generic object. """ def __init__(self, data, api): self.temp_id = "" self.data = data self.api = api def __setitem__(self, key, value): self.data[key] = value def __getitem__(self, key): ...
Doist/todoist-python
todoist/models.py
Python
mit
8,035
import time import logging from collections import Counter from utils.choice_enum import ChoiceEnum from alarms.connectors import CdbConnector logger = logging.getLogger(__name__) class OperationalMode(ChoiceEnum): """ Operational Mode of a monitor point value. """ STARTUP = 0 INITIALIZATION = 1 CLO...
IntegratedAlarmSystem-Group/ias-webserver
alarms/models.py
Python
lgpl-3.0
17,630
# coding=utf-8 # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
bacaldwell/ironic
ironic/tests/unit/common/test_driver_factory.py
Python
apache-2.0
7,434
# -*- coding: utf8 -*- """ eventlogging unit tests ~~~~~~~~~~~~~~~~~~~~~~~ This module contains test fixtures. """ from __future__ import unicode_literals import copy import io import signal import eventlogging import sqlalchemy TEST_SCHEMA_SCID = ('TestSchema', 123) _schemas = { eventlogging.schema.CA...
legoktm/wikihow-src
extensions/EventLogging/server/tests/fixtures.py
Python
gpl-2.0
5,994
from distutils.core import setup setup( name='mcloud_iside', version='0.1dev', url='https://github.com/MutakamwoyoCloud/MCloud', description='part of the MCloud service', packages=['mcloud_iside',], license='GNU General Public License v3 or later (GPLv3+)', long_description=open('README.md'...
MutakamwoyoCloud/MCloud
inet_side/setup.py
Python
agpl-3.0
332
import nose from nose.tools import * from unittest import TestCase from datetime import datetime, timedelta from repo.date_iterator import DateIterator class DateIteratorTests(TestCase): def test_date_iterator_returns_self_on_iter(self): d = DateIterator(datetime.now(), datetime.now()) eq_(d, d._...
markdrago/caboose
src/test/repo/date_iterator_tests.py
Python
mit
1,409
# Copyright (c) 2015, Laurent Duchesne <l@urent.org> # 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 requ...
lduchesne/python-openstacksdk-hubic
hubic/hubic.py
Python
apache-2.0
11,237
#!/usr/bin/python3 # # The Qubes OS Project, http://www.qubes-os.org # # Copyright (C) 2021 Norbert Kamiński <norbert.kaminski@3mdeb.com> # # SPDX-License-Identifier: LGPL-2.1+ # import sys import subprocess import os from fwupd_common_vm import FwupdVmCommon FWUPD_VM_DIR = "/home/user/.cache/fwupd" FWUPD_VM_UPDATE...
hughsie/fwupd
contrib/qubes/src/vms/fwupd_download_updates.py
Python
lgpl-2.1
4,434
#!/usr/bin/python # -*- coding: utf-8 -*- # init.py file is part of slpkg. # Copyright 2014-2017 Dimitris Zlatanidis <d.zlatanidis@gmail.com> # All rights reserved. # Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg # Slpkg is free software: you can redistribu...
websafe/slpkg
slpkg/init.py
Python
gpl-3.0
31,534
""" Socket IO connections """ from datetime import timedelta from tornado import ioloop, gen from tornadio2 import SocketConnection, TornadioRouter, SocketServer, event, gen class QueryConnection(SocketConnection): def long_running(self, value, callback): """Long running task implementation. Simp...
godsarmy/BAT
connections.py
Python
mit
1,218
from rest_framework import viewsets from rest_framework.response import Response from treeherder.model.derived import (ArtifactsModel, JobsModel) from treeherder.model.error_summary import get_artifacts_that_need_bug_suggestions from treeherder.model.tasks import populate_error_su...
gbrmachado/treeherder
treeherder/webapp/api/artifact.py
Python
mpl-2.0
3,604
""" This module provides classes to build an OrderList for input to a plant, including the Order instances and their Recipe instances. """ from xml.dom import minidom from plant import CraneMoveTime class Recipe(object): """ This class provides a Recipe for an Order. It is a list (or dictionary) of tuples (str mac...
fredmorcos/attic
projects/plantmaker/archive/20100505/order.py
Python
isc
5,912
#!/usr/bin/env python import re pair = re.compile(r'(.)\1') def contains_two_pairs(string): return len(re.findall(pair, string)) >= 2 def contains_iol(string): banned_letters = ['i','o','l'] for letter in banned_letters: if letter in string: return True return False def contains_abc_string(string...
jatowler/adventofcode-2015
11/part2.py
Python
mit
1,461
#!/usr/bin/python # -*- coding: utf-8 -*- #from openerp.tools import #debug UNIDADES = ( '', 'UN ', 'DOS ', 'TRES ', 'CUATRO ', 'CINCO ', 'SEIS ', 'SIETE ', 'OCHO ', 'NUEVE ', 'DIEZ ', 'ONCE ', 'DOCE ', 'TRECE ', 'CATO...
ClearCorp-dev/odoo-clearcorp
TODO-8.0/payment_receipt_report/report/amount_to_text.py
Python
agpl-3.0
3,788
from tools.load import LoadMatrix lm=LoadMatrix() data = lm.load_numbers('../data/fm_train_real.dat') parameter_list = [[data,10],[data,20]] def converter_laplacianeigenmaps_modular(data,k): from shogun.Features import RealFeatures from shogun.Converter import LaplacianEigenmaps features = RealFeatures(data) ...
ratschlab/ASP
examples/undocumented/python_modular/converter_laplacianeigenmaps_modular.py
Python
gpl-2.0
588
from ztag.annotation import * class QNXFox(Annotation): port = None protocol = protocols.FOX subprotocol = protocols.FOX.DEVICE_ID tests = { "qnx_npm6": { "global_metadata": { "os": OperatingSystem.QNX, } } } def process(self, obj, met...
zmap/ztag
ztag/annotations/fox_qns.py
Python
apache-2.0
2,067
from django.urls import path, re_path, include from django.utils.translation import ugettext_lazy as _ from . import views as www urlpatterns = [ re_path(r'^$', www.Index.as_view(), name='index'), re_path(_('^topic_collections_url$'), www.TopicCollections.as_view(), name='topic_collections'), r...
WebArchivCZ/Seeder
Seeder/www/urls.py
Python
mit
3,183
import pychemia import tempfile from .samples import CaTiO3 def test_xyz(): """ Test (pychemia.io.xyz) : """ st1 = CaTiO3() st1.set_periodicity(False) file = tempfile.NamedTemporaryFile() pychemia.io.xyz.save(st1, file.name) st2 = pychemia.io.xyz.lo...
MaterialsDiscovery/PyChemia
tests/test_io.py
Python
mit
625
''' DATE CREATED: 14-05-2014 DATE FINISHED: 21-05-2014 CREATOR: Martin Dessauer CONTACT: martin.dessauer@me.com, @codezeb (Github) COPYRIGHT: 2014 Martin Dessauer LICENSE: GPLv3 ''' import sys # for sys.argv import getch # reading input (arrow keys) from binascii import hexlify # l158 from time ...
maride/pyker
pyker3.py
Python
gpl-3.0
6,844
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gitzen.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
LHN/lhn-gitzen
manage.py
Python
bsd-3-clause
249
""" NOTE: Probably do not actually need any of this: equivalent tests have been incorporated into get_lines in process_methods.py Contains methods used to "clean up" a lines_list, i.e. remove lines that are likely not actually there """ import numpy as np from main import * # from process_methods import * import math ...
justinjoh/get-ROI
cleanup_methods.py
Python
mit
1,444
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Li...
pypa/warehouse
warehouse/integrations/vulnerabilities/osv/views.py
Python
apache-2.0
2,559
import tkinter as tk import tkinter.simpledialog as tksimpledialog from tkinter import ttk from itertools import accumulate import bisect from sol.config import GlobalConfig C = GlobalConfig() class ClipControl: def __init__(self, root, backend, layer): self.root = root self.backend = backend ...
pussinboot/sol
sol/gui/tk_gui/clip_control.py
Python
mit
47,930
from sklearn.cluster import MiniBatchKMeans, KMeans from scikits.talkbox.features import mfcc import numpy as np def mfcc_atomic(x, fs, nwin=256, nfft=512, nceps=10, drop=1): return mfcc(x, nwin, nfft, fs, nceps)[0][:, drop:] def stack_double_deltas(x): '''Stacks x on top of the various derivatives of x''' ...
athuras/attention
features.py
Python
gpl-2.0
2,232
#!/usr/bin/python3 import os import json import urllib.request from config import * try: nodes_request = urllib.request.Request(nodes_json_url) nodes_json_response = urllib.request.urlopen(nodes_request) graph_request = urllib.request.Request(graph_json_url) graph_json_response = urllib.request.urlope...
freifunkh/mesh_branchfilter
mesh_branchfilter.py
Python
mit
2,620
# Authors : Denis A. Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License : BSD 3-clause from copy import deepcopy import math import numpy as np from scipy import fftpack # XXX explore cuda optimazation at some point. from ..io.pick import pick_type...
rajegannathan/grasp-lift-eeg-cat-dog-solution-updated
python-packages/mne-python-0.10/mne/time_frequency/_stockwell.py
Python
bsd-3-clause
9,819
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import cint, cstr, flt, fmt_money, formatdate, getdate from frappe import msgprint, _, scrub from erpnext.setup.util...
gangadhar-kadam/laganerp
erpnext/accounts/doctype/journal_voucher/journal_voucher.py
Python
agpl-3.0
25,574
#========================================================================== # # Copyright Insight Software Consortium # # 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...
daviddoria/itkHoughTransform
Wrapping/WrapITK/Languages/Python/Tests/GeodesicActiveContourImageFilter.py
Python
apache-2.0
6,169
# -*- coding: utf-8 -*- #------------------------------------------------------------ import urlparse,urllib2,urllib,re import os, sys from core import jsontools as json from core import scrapertools from core import servertools from core.item import Item from platformcode import config, logger from core import httptoo...
alfa-jor/addon
plugin.video.alfa/channels/vporn.py
Python
gpl-3.0
5,411
from .models import BlogPost from os import path, listdir import yaml import time from gitcms.parsedate import parsedatetime from gitcms.pages.load import preprocess_rst_content from gitcms.tagging.models import tag_for def loaddir(directory, clear=False): if clear: BlogPost.objects.all().delete() q...
luispedro/django-gitcms
gitcms/blog/load.py
Python
agpl-3.0
1,618
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import test_ui
Vauxoo/e-commerce
website_sale_require_legal/tests/__init__.py
Python
agpl-3.0
88
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 Nandaja Varma <nvarma@redhat.com> # Copyright 2018 Red Hat, Inc. # # 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_M...
kustodian/ansible
lib/ansible/modules/storage/glusterfs/gluster_peer.py
Python
gpl-3.0
5,845
# Tweepy # Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. import os import mimetypes from tweepy.binder import bind_api from tweepy.error import TweepError from tweepy.parsers import ModelParser from tweepy.utils import list_to_csv class API(object): """Twitter API""" def __init__(self, au...
tkaitchuck/nupic
external/linux64/lib/python2.6/site-packages/tweepy/api.py
Python
gpl-3.0
22,718
#!/usr/bin/python3 def sanitize(time_string): if '-' in time_string: splitter = '-' elif ':' in time_string: splitter = ':' else: return(time_string) (mins, secs) = time_string.strip().split(splitter) return(mins + '.' + secs) def get_coach_data(filename): try: with open(filename) as fn: ...
clovemfeng/studydemo
20140617/userlist_data.py
Python
gpl-2.0
657
""" Acceptance tests for Studio related to the split_test module. """ from unittest import skip from ..fixtures.course import CourseFixture, XBlockFixtureDesc from ..pages.studio.component_editor import ComponentEditorView from test_studio_container import ContainerBase from ..pages.studio.utils import add_advanced_...
geekaia/edx-platform
common/test/acceptance/tests/test_studio_split_test.py
Python
agpl-3.0
6,703
"""Extracts features for the training set of the given file lists using the given feature extractor.""" import argparse import bob.ip.facedetect import importlib import os, math import bob.core logger = bob.core.log.setup('bob.ip.facedetect') # create feature extractor LBP_VARIANTS = { 'ell' : {'circular' : Tru...
bioidiap/bob.ip.facedetect
bob/ip/facedetect/script/extract_training_features.py
Python
gpl-3.0
5,265
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2016-09-04 23:50 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('courses', '0013_auto_20160903_0212'), ] operations = [ migrations.RenameField( ...
aspc/mainsite
aspc/courses/migrations/0014_auto_20160904_2350.py
Python
mit
1,605
""" Compatibility functions for older versions of nibabel Nibabel <= 1.3.0 do not have these attributes: * header * affine * dataobj The equivalents for these older versions of nibabel are: * obj.get_header() * obj.get_affine() * obj._data With old nibabel, getting unscaled data used `read_img_data(img, prefer="un...
alexis-roche/nipy
nipy/io/nibcompat.py
Python
bsd-3-clause
2,229
"""Utils for time travel testings.""" def _t(rel=0.0): """Return an absolute time from the relative time given. The minimal allowed time in windows is 86400 seconds, for some reason. In stead of doing the arithmetic in the tests themselves, this function should be used. The value `86400` is expo...
snudler6/time-travel
src/tests/utils.py
Python
mit
492
# Tests for rich comparisons import unittest from test import test_support import operator class Number: def __init__(self, x): self.x = x def __lt__(self, other): return self.x < other def __le__(self, other): return self.x <= other def __eq__(self, other): return...
trivoldus28/pulsarch-verilog
tools/local/bas-release/bas,3.9/lib/python/lib/python2.3/test/test_richcmp.py
Python
gpl-2.0
11,493
#!/usr/bin/python # 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. # # Ansible is distributed...
Tatsh-ansible/ansible
lib/ansible/modules/cloud/amazon/iam.py
Python
gpl-3.0
34,464
#!/usr/bin/env python import sys, getopt, argparse from kazoo.client import KazooClient import json def loadZookeeperOptions(opts,zk): node = "/all_clients/"+opts['client']+"/offline/semvec" if zk.exists(node): data, stat = zk.get(node) jStr = data.decode("utf-8") print "Found zookeeper...
SeldonIO/seldon-server
scripts/zookeeper/set-client-config.py
Python
apache-2.0
1,889
# -*- coding: utf-8 -*- # Copyright (c) 2015-2018, Exa Analytics Development Team # Distributed under the terms of the Apache License 2.0 """ Input Generator and Parser ############################### """
avmarchenko/exatomic
exatomic/adf/inputs.py
Python
apache-2.0
205
# mssql/information_schema.py # Copyright (C) 2005-2018 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php # TODO: should be using the sys. catalog with SQL Server, not informatio...
fernandog/Medusa
ext/sqlalchemy/dialects/mssql/information_schema.py
Python
gpl-3.0
6,481
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2010-2011 BAAMTU SARL (<http://www.baamtu.sn>). # contact: leadsn@baamtu.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affer...
ksrajkumar/openerp-6.1
openerp/addons/l10n_syscohada/__openerp__.py
Python
agpl-3.0
1,893
# -------------------------------------------------------- # FCN # Copyright (c) 2016 RSE at UW # Licensed under The MIT License [see LICENSE for details] # Written by Yu Xiang # -------------------------------------------------------- import numpy as np import normals.gpu_normals from fcn.config import cfg import cv2...
yuxng/Deep_ISM
FCN/lib/utils/backprojection.py
Python
mit
3,426
from django.db import models from django.utils import timezone from simple_history.models import HistoricalRecords from edc_base.model.models.base_uuid_model import BaseUuidModel from edc_consent.field_mixins import PersonalFieldsMixin from edc_consent.managers import ConsentManager from edc_consent.model_mixins impo...
botswana-harvard/ba-namotswe
ba_namotswe/models/subject_consent.py
Python
gpl-3.0
1,362
"""This module contains a demo class The Class has four methods - __init__ - add - subtract - operations_completed >>> from classes import Foo >>> foo = Foo() >>> foo.add(2, 4) 6 >>> foo.subtract(5,2) 3 >>> foo.operations_completed() 2 """ class Foo(object): """The Foo object!""" def __init__(self): ...
CLEpy/CLEpy-MotM
Sphinx/package/code/classes.py
Python
mit
914
import pyttsx engine = pyttsx.init() engine.say("Sally sells seashells by the seashore.") engine.say("The quick brown fox jumped over the lazy dog.") engine.runAndWait()
AdrienVR/NaoSimulator
dep/code/speak.py
Python
lgpl-3.0
170
#!/bin/env python from sys import exit import argparse import rsa rsaBits = 1024 pubName = 'pub_rsa.pem' priName = 'pri_rsa.pem' def genKey(): # generate key couple (pubKey, priKey) = rsa.newkeys(rsaBits) # write public key pub = pubKey.save_pkcs1() pubFile = open(pubName, 'w+') pubFile.write(...
zhaozq/rsaencrypt_self_data
rsacry.py
Python
mit
2,154
#!/usr/bin/env python """ Common utility functions """ import os import re import sys import gzip import bz2 import numpy def init_gene_DE(): """ Initializing the gene structure for DE """ gene_det = [('id', 'f8'), ('chr', 'S15'), ('exons', numpy.dtype), ...
ratschlab/oqtans_tools
rQuant/2.2/tools/helper.py
Python
mit
6,595
# Copyright (c) 2015-2016 Claudiu Popa <pcmanticore@gmail.com> # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/master/COPYING """Checker for anything related to the async protocol (PEP 492).""" import astroid from astroid import exc...
axbaretto/beam
sdks/python/.tox/lint/lib/python2.7/site-packages/pylint/checkers/async.py
Python
apache-2.0
2,898
from runscript import * """ Interpolation options: keys - list of frames to interpolate in order n - distance between keyframes settings - interpolation settings (see bottom of script) """ def interpolation(keys, n=50, **kwargs): last = 0 cache = [] #Set defaults loop = kwargs...
bobbyrward/fr0st
scripts/interp_gen.py
Python
gpl-3.0
9,398
from django.conf.urls import url from . import views urlpatterns = [ url(r'^process/$', views.payment_process, name='process'), url(r'^done/$', views.payment_done, name='done'), url(r'^canceled/$', views.payment_canceled, name='canceled'), ]
EssaAlshammri/django-by-example
online-shop/myshop/payment/urls.py
Python
mit
257
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com # # 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 ...
linsicai/or-tools
examples/python/organize_day.py
Python
apache-2.0
3,062
from invoke import task, run #from fabric.api import local, lcd, get, env #from fabric.operations import require, prompt #from fabric.utils import abort import requests import rdflib import getpass import os.path import os import setlr from os import listdir from rdflib import * import logging CHEAR_DIR='chear.d/' H...
tetherless-world/chear-ontology
tasks.py
Python
apache-2.0
3,872
from django.conf.urls.defaults import patterns, include, url from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^$', 'starter.views.home', name='home'), # url(r'^starter/', include('starter.foo.urls')), # Uncomment the a...
Plexical/django-starter
starter/urls.py
Python
isc
818
#!/usr/bin/python # The usual preamble import numpy as np import grizzly.numpy_weld as npw import pandas as pd import grizzly.grizzly as gr import time # Get data (NYC 311 service request dataset) and start cleanup raw_data = pd.read_csv('data/us_cities_states_counties.csv', delimiter='|') raw_data.dropna(inplace=Tru...
weld-project/weld
examples/python/grizzly/get_population_stats_simplified_grizzly.py
Python
bsd-3-clause
1,266
#!/usr/bin/python3 # Copyright 2020 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. # Lint as: python3 """The tool converts a textpb into a binary proto using chromium protoc binary. After converting a feed response textp...
endlessm/chromium-browser
components/feed/tools/mockserver_textpb_to_binary.py
Python
bsd-3-clause
2,151
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging logger = logging.get_logger(__name__) def copy_layers(src_layers: nn.ModuleList, des...
huggingface/transformers
examples/research_projects/seq2seq-distillation/make_student.py
Python
apache-2.0
8,172
"""Testcase for RCU - RSP data interface using PRSG, based on TCL testcase 5.10 Note: No specific arguments """ ################################################################################ # Constants nof_reflets_ap = rsp.c_nof_reflets_ap nof_beamlets = rsp.c_nof_beamlets # maximum capable by RSP gate...
kernsuite-debian/lofar
LCU/StationTest/tc/prsg.py
Python
gpl-3.0
6,582
import os, sys try: import ctypeslib.h2xml as h2xml import ctypeslib.xml2py as xml2py import ctypeslib.codegen as codegen except: print ('Error: required Python ctypeslib module not installed!') sys.exit(-1) try: from setuptools import setup except ImportError: from distutils.core import s...
demorest/mark5access
python/setup.py
Python
gpl-3.0
4,324
from __future__ import print_function from numpy import * from scipy.io import readsav print('Calculating P..') a=transpose(readsav('phi.idl.dat')['phi']) fa=fft.fft(a,axis=2) save('fp',fa)
kevinpetersavage/BOUT-dev
examples/elm-pb/Python/fftall.py
Python
gpl-3.0
192
import numpy from models.game.bots.MinimaxBot import MinimaxBot from models.game.Board import Board class Heuristic1Bot(MinimaxBot): """ Minimax bot that plays using the H1 heuristic """ def __init__(self, number, time_limit=10, name=None): """ This bot plays using a simple heuristic based on the ...
zachdj/ultimate-tic-tac-toe
models/game/bots/Heuristic1Bot.py
Python
mit
2,617
# Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de> # See COPYING for license information. import os import sys from tempfile import mkstemp import subprocess import re import glob import time import datetime import shutil import shlex import bz2 import fnmatch import gc import ipaddress import argparse...
ClusterLabs/crmsh
crmsh/utils.py
Python
gpl-2.0
85,016
""" A fake DB-API 2 driver. """ # DB names used to trigger certain behaviours. INVALID_DB = 'invalid-db' INVALID_CURSOR = 'invalid-cursor' HAPPY_OUT = 'happy-out' apilevel = '2.0' threadsafety = 2 paramstyle = 'qmark' def connect(database): return Connection(database) class Connection(object): """ A f...
kgaughan/dbkit
tests/fakedb.py
Python
mit
3,435
#!/usr/bin/env python from __future__ import division import json class TableReader(object): def __init__(self, table_str): self.table_str = table_str @property def table_id(self): if not hasattr(self, '_table_id'): self._table_id = self._parse_field('id') return self._...
jairideout/protobiom
protobiom/convert.py
Python
bsd-3-clause
4,907
from pylab import * from numpy import * ############################################################################################## print("Program Running...") ###Program Constants mass = 1 K = 1 omegaD = 1 omegaD_0 = 1 #when this value is not zero, omegaD will be the multiple of omega0 by this amount -...
hrishioa/ISci
sh-w-damp2.py
Python
gpl-2.0
3,962
#!/usr/bin/env python # Copyright (c) 2013 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. import os import subprocess import sys BUILDBOT_DIR = os.path.join(os.path.dirname(__file__), '..') sys.path.append(BUILDBOT_DIR) ...
Teamxrtc/webrtc-streaming-node
third_party/webrtc/src/chromium/src/build/android/buildbot/tests/bb_run_bot_test.py
Python
mit
922
# -*- coding: utf-8 -*- # Copyright (c) 2014-2017 Andrea Baldan # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # Th...
codepr/creak
creak/utils.py
Python
gpl-3.0
10,336
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved. # # This file is part of kiwi. # # kiwi 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...
SUSE/kiwi
kiwi/tasks/system_create.py
Python
gpl-3.0
3,502
# -*- coding: utf-8 -*- __copyright__ = """ Copyright (C) 2008, Karl Hasselström <kha@treskal.com> This program 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 ...
vincele/stgit
stgit/commands/redo.py
Python
gpl-2.0
2,033
def init(): global ARGS global CONFIG_FILE_CONTENT global CONFIG_FILE_NAME global CONFIG_FILE_PATH global GIT_OBJECTS ARGS = [] CONFIG_FILE_CONTENT = [] CONFIG_FILE_NAME = ".giwyn" CONFIG_FILE_PATH = "" GIT_OBJECTS = []
k0pernicus/giwyn
giwyn/lib/settings/settings.py
Python
gpl-3.0
261
# This file is part of Bika LIMS # # Copyright 2011-2016 by it's authors. # Some rights reserved. See LICENSE.txt, AUTHORS.txt. from AccessControl import ClassSecurityInfo from Products.ATExtensions.Extensions.utils import makeDisplayList from Products.ATExtensions.ateapi import RecordField, RecordsField from Products...
rockfruit/bika.lims
bika/lims/browser/fields/coordinatefield.py
Python
agpl-3.0
1,812
import logging from abc import ABCMeta, abstractmethod from Tribler.community.market.core.message import TraderId from Tribler.community.market.core.transaction import TransactionNumber, TransactionId, Transaction class TransactionRepository(object): """A repository interface for transactions in the transaction ...
vandenheuvel/tribler
Tribler/community/market/core/transaction_repository.py
Python
lgpl-3.0
5,726
#!/usr/bin/python # # This source file is part of appleseed. # Visit http://appleseedhq.net/ for additional information and resources. # # This software is released under the MIT license. # # Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited # Copyright (c) 2014-2015 Francois Beaune, The appleseedhq Organi...
Vertexwahn/appleseed
scripts/rendermany.py
Python
mit
6,731
""" Fetch whole SNMP table ++++++++++++++++++++++ Send a series of SNMP GETNEXT requests using the following options: * with SNMPv1, community 'public' * over IPv4/UDP * to an Agent at demo.snmplabs.com:161 * for some columns of the IF-MIB::ifEntry table * stop when response OIDs leave the scopes of initial OIDs Fun...
etingof/pysnmp
examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
Python
bsd-2-clause
1,443
import functools import os import psutil import pytest import threading import time from twisted.internet import threads, reactor # # pytest customizations # # mark benchmark tests using their group names (thanks ionelmc! :) def pytest_collection_modifyitems(items, config): for item in items: bench = it...
leapcode/soledad
tests/benchmarks/conftest.py
Python
gpl-3.0
5,004
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-01-23 20:31 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import django.db.models.manager import django.utils.timezone import mptt.fields class Migration(migrations.Migration): initial...
Nikola-K/django_reddit
reddit/migrations/0001_initial.py
Python
apache-2.0
3,960
# Copyright (C) 2016 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/LICENSE-2.0 # # Unless required by appli...
tamihiro/gobgp
test/scenario_test/route_server_softreset_test.py
Python
apache-2.0
4,831
# -*- coding: utf-8 -*- # # Picard, the next-generation MusicBrainz tagger # Copyright (C) 2006 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...
samj1912/picard
picard/config.py
Python
gpl-2.0
9,722
# -*- coding: utf-8 -*- from kivy.app import App from kivy.uix.floatlayout import FloatLayout from kivy.uix.relativelayout import RelativeLayout from kivy.uix.gridlayout import GridLayout from kivy.uix.scatterlayout import ScatterLayout from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from k...
ThomasHangstoerfer/pyHomeCtrl
verboseclock.py
Python
apache-2.0
12,867
__copyright__ = 'Copyright(c) Gordon Elliott 2017' """ """ from a_tuin.db import RelationMap, TableMap, PagedQuery, InstanceQuery from glod.model.statement_item import StatementItem, StatementItemDesignatedBalance from glod.model.statement_item_collection import StatementItemCollection from glod.model.references im...
gordon-elliott/glod
src/glod/db/statement_item.py
Python
mit
944
from __future__ import absolute_import from .hedwig import start_consumer
ofpiyush/hedwig-py
tests/djangotest/djangotest/__init__.py
Python
mit
74
#!/usr/bin/env python3 # Copyright 2018 Google 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 ...
adjackura/compute-image-tools
daisy_workflows/linux_common/utils/diskutils.py
Python
apache-2.0
2,614
import dsz import os import re from task import * class Audit(Task, ): def __init__(self, file): Task.__init__(self, file, 'Audit') def CreateCommandLine(self): return ['audit -status'] TaskingOptions['_auditTasking'] = Audit
DarthMaulware/EquationGroupLeaks
Leak #5 - Lost In Translation/windows/Resources/Tasking/PyScripts/Lib/tasking/audit.py
Python
unlicense
253
import cv2 # Haar-like特徴分類器の読み込み face_cascade = cv2.CascadeClassifier('data/haarcascades/haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('data/haarcascades/haarcascade_eye.xml') # イメージファイルの読み込み img = cv2.imread('face.jpg') # グレースケール変換 gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 顔を検知 fac...
yukihirai0505/tutorial-program
programming/python/opencv/sample/main.py
Python
mit
1,042
class Allergies: _allergies = [ "eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats" ] def __init__(self, score): self.score = score def is_allergic_to(self, allergy): return self.scor...
ZacharyRSmith/xpython
allergies/example.py
Python
mit
499
# Copyright 2017 The TensorFlow Authors All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
unnikrishnankgs/va
venv/lib/python3.5/site-packages/tensorflow/models/pcl_rl/policy.py
Python
bsd-2-clause
16,946
# # Copyright 2013 Quantopian, 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 wr...
jimgoo/zipline-fork
zipline/finance/risk/period.py
Python
apache-2.0
9,089
''' Helper functions for writing and opening ntuples. Copyright (c) 2010 Juan Palacios juan.palacios.puyana@gmail.com Subject to the Lesser GNU Public License - see < http://www.gnu.org/licenses/lgpl.html> ''' # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
juanchopanza/pyhistuples
pyhistuples/pyntuple/write.py
Python
lgpl-3.0
1,283
# Copyright 2015 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. """Top-level presubmit script for testing/trigger_scripts. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about...
scheib/chromium
testing/trigger_scripts/PRESUBMIT.py
Python
bsd-3-clause
883
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('taxbrain', '0082_auto_20150314_2206'), ] operations = [ migrations.RenameField( model_name='taxsaveinputs', ...
talumbau/webapp-public
webapp/apps/taxbrain/migrations/0083_auto_20150314_2207.py
Python
mit
855