code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from rest_framework import serializers
class AttachmentSerializer(serializers.Serializer):
pass
"""
//*
// As of 2017-06-13, up to 38 attachments can be worn per agent
// max of 328 bytes per attach point (if name and description are maxed out).
// x38 = 12464 bytes
// without descriptions: 188 * 38 = 7144 by... | tapple/nsize-web | nsize/body_detector/serializers.py | Python | agpl-3.0 | 1,173 |
from cartodb import CartoDBAPIKey
import json
import datetime
class CartoTransaction(object):
_SQL_INSERT = "insert into %s ( the_geom, type, happened_at, message ) values( %s, %s, %s, %s);"
def __init__(self, api_key, domain, table, debug = False):
self.cl = CartoDBAPIKey(api_key, domain)
se... | Ramblurr/wander | wander/cartodbutils/__init__.py | Python | agpl-3.0 | 1,661 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Import module for legacy KDE .po files.
This is an extension of standard gettext PO files.
You can read more about this file format from:
* http://l10n.kde.org/docs/translati... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/translations/utilities/kde_po_importer.py | Python | agpl-3.0 | 3,250 |
import pickle
from content_stats import Compare_regions
from content_stats import Title_stats
# load saved dictionaries
nz_titles = pickle.load(open('nz/all_movies_dict.p', 'rb'))
us_titles = pickle.load(open('nz/all_movies_dict.p', 'rb'))
| NZRS/content-analysis | example_usage.py | Python | agpl-3.0 | 246 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | kaji-project/shinken | shinken/objects/itemgroup.py | Python | agpl-3.0 | 5,862 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-2013 Elanz (<http://www.openelanz.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | noemis-fr/old-custom | e3z_add_delivery_method/sale_order.py | Python | agpl-3.0 | 2,622 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class FieldLevelExplanation(Document):
pass
| gangadharkadam/office_erp | erpnext/projects/doctype/field_level_explanation/field_level_explanation.py | Python | agpl-3.0 | 283 |
'''
This module is part of ngs_backbone. This module provide mapping related
analyses
Created on 15/03/2010
@author: peio
'''
# Copyright 2009 Jose Blanca, Peio Ziarsolo, COMAV-Univ. Politecnica Valencia
# This file is part of franklin.
# franklin is free software: you can redistribute it and/or modify
# it under the... | JoseBlanca/franklin | franklin/backbone/mapping.py | Python | agpl-3.0 | 16,787 |
from odoo import models, fields, api, _
# import odoo.tools as tools
try:
from pyafipws.iibb import IIBB
except ImportError:
IIBB = None
# from pyafipws.padron import PadronAFIP
from odoo.exceptions import UserError
import logging
import json
import requests
# from dateutil.relativedelta import relativedelta
_l... | adhoc-dev/odoo-argentina | l10n_ar_account_withholding/models/res_company.py | Python | agpl-3.0 | 9,290 |
"""
Tests for the recently enrolled messaging within the Dashboard.
"""
import datetime
import unittest
import ddt
from django.conf import settings
from django.urls import reverse
from django.utils.timezone import now
from opaque_keys.edx import locator
from pytz import UTC
from six.moves import range, zip
from com... | msegado/edx-platform | common/djangoapps/student/tests/test_recent_enrollments.py | Python | agpl-3.0 | 8,149 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('commerce', '0008_auto_20150110_2000'),
]
operations = [
migrations.AlterField(
model_name='order',
n... | jtraulle/django-ecommerce | commerce/migrations/0009_auto_20150110_2012.py | Python | agpl-3.0 | 1,529 |
# -*- coding: utf-8 -*-
# Copyright 2017 Ainara Galdona - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Account Invoice Merge Stock Picking",
"version": "8.0.1.0.0",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "http://www.avanzosc.es",
"contribut... | Daniel-CA/odoo-addons | account_invoice_merge_stock_picking/__openerp__.py | Python | agpl-3.0 | 596 |
"""
Various caching help functions and classes.
"""
from django.core.cache import cache
DEFAULT_CACHE_DELAY = 60 * 60 # Default cache delay is 1hour. It's quite long.
USERACCOUNT_CACHE_DELAY = 60 * 3 # 3 minutes here. This is used to know if a user is online or not.
class _AbstractCache(object):
... | numericube/twistranet | twistranet/core/caches.py | Python | agpl-3.0 | 1,772 |
import pytest
from django.urls import reverse
from adhocracy4.modules.models import Module
from adhocracy4.test.helpers import redirect_target
@pytest.mark.django_db
def test_module_delete_perms(client, phase, user, user2):
module = phase.module
module_delete_url = reverse('a4dashboard:module-delete', kwarg... | liqd/a4-meinberlin | tests/dashboard/test_dashboard_views_module_delete.py | Python | agpl-3.0 | 3,903 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgarren/spack | var/spack/repos/builtin/packages/r-affyio/package.py | Python | lgpl-2.1 | 1,756 |
#!/usr/bin/python
from distutils.core import setup, Extension, extension_keywords
#print extension_keywords
module1 = Extension('krui',
sources = ['snns/krui.c'],
include_dirs = ['../kernel/sources'],
library_dirs = ['../kernel/sources'],
libraries = ['kernel','func','fl'])
set... | mwri/snns | python/setup.py | Python | lgpl-2.1 | 618 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | lib/spack/spack/cmd/blame.py | Python | lgpl-2.1 | 4,597 |
import re
import sjconfparts.exceptions
class Error(sjconfparts.exceptions.Error):
pass
class ConversionError(Error):
pass
class ConversionList:
"""Custom list implementation, linked to the related Conf.
Each modification of the list will auto-update the string representation
of the list dir... | SmartJog/sjconf | sjconfparts/type.py | Python | lgpl-2.1 | 16,215 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/scalasca/package.py | Python | lgpl-2.1 | 2,845 |
##cobra.solvers.glpk_solver
#This script provides wrappers for libglpk-java 1.0.22 and pyglpk 0.3
from warnings import warn
from copy import deepcopy
###solver specific parameters
from .parameters import status_dict, variable_kind_dict, \
sense_dict, parameter_mappings, parameter_defaults, \
objective_senses,... | jerkos/cobrapy | cobra/solvers/glpk_solver_java.py | Python | lgpl-2.1 | 14,112 |
# This file is part of the GOsa framework.
#
# http://gosa-project.org
#
# Copyright:
# (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.
import logging
import os
from zipfile import ZipFile
from gosa.backend.routes.sse.main import SseHan... | gonicus/gosa | backend/src/gosa/backend/plugins/upload/handler/workflow.py | Python | lgpl-2.1 | 2,661 |
from tendrl.commons import flows
class CephIntegrationBaseFlow(flows.BaseFlow):
def __init__(self, *args, **kwargs):
super(CephIntegrationBaseFlow, self).__init__(*args, **kwargs)
| r0h4n/ceph-integration | tendrl/ceph_integration/flows/__init__.py | Python | lgpl-2.1 | 194 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Red Hat, Inc.
#
# 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.
#
# This ... | fedora-infra/the-new-hotness | hotness/responses/response_failure.py | Python | lgpl-2.1 | 6,212 |
# This file is part of cclib (http://cclib.github.io), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2006, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Public version 2.1 or later. You s... | Clyde-fare/cclib | src/cclib/bridge/cclib2openbabel.py | Python | lgpl-2.1 | 1,577 |
#!/usr/bin/env python
# Build a bunch of SRPMs
import argparse
import getopt
import sys
import os
import glob
import subprocess
import shutil
import rpm
import hashlib
import time
from planex.globals import (BUILD_ROOT_DIR, SRPMS_DIR, RPMS_DIR, BUILD_DIR,
SPECS_GLOB)
from planex.util imp... | jonludlam/planex | planex/build.py | Python | lgpl-2.1 | 9,798 |
"""Social content items: messages aka status updates, private messages, etc."""
from __future__ import annotations
import re
from sqlalchemy.orm import relationship
from sqlalchemy.orm.query import Query
from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.types import Integer, UnicodeText
from abilian.c... | abilian/abilian-sbe | src/abilian/sbe/apps/social/models.py | Python | lgpl-2.1 | 2,645 |
#
# images driver for migration (without FS transfer)
#
import os
import tempfile
import rpyc
import tarfile
import time
import shutil
import time
img_path = "/var/local/p.haul-fs/"
img_tarfile = "images.tar"
xfer_size = 64 * 1024
def copy_file(s, d):
while True:
chunk = s.read(xfer_size)
if not chunk:
break... | avagin/p.haul | p_haul_img.py | Python | lgpl-2.1 | 2,640 |
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_4(fissureCoude):
"""
problème de fissure du Coude : ASCOU09A
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
... | FedoraScientific/salome-smesh | src/Tools/blocFissure/CasTests/fissureCoude_4.py | Python | lgpl-2.1 | 4,424 |
# -*- coding: utf-8 -*-
import socket
from paramiko import SSHClient, AutoAddPolicy, AuthenticationException
from bssh.utils import env
from bssh.auth import get_pkey
from bssh.logger import logger
def connect(
hostname=None,
port=22,
username=None,
password=None,
pkey=None,... | liwanggui/bssh | bssh/network.py | Python | lgpl-2.1 | 1,271 |
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK core.
#
# REDHAWK core 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
... | RedhawkSDR/framework-codegen | redhawk/codegen/jinja/java/ports/mapping.py | Python | lgpl-3.0 | 1,372 |
#!/usr/bin/python
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
setup(
name='django-sizefield',
version='0.10.ceda',
author='Mathieu Leplatre',
author_email='contact@mathieu-leplatre.info',
url='https://github.com/leplatrem/django-sizefield... | cedadev/django-sizefield | setup.py | Python | lgpl-3.0 | 1,205 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from entropyfw import System
from s_pico_tc08.module import EntropyPicoTc08
from s_tti_cpx.module import EntropyTTiCPX
from s_laird_optotec_ot15.module import EntropyLairdOT15ConstantQc
from .s_controller.module import EntropyController as GFAEntropyController
from s_eventlogg... | otger/gfa_thermal_entropySys | gfa_thermal/monitor_system.py | Python | lgpl-3.0 | 1,028 |
#!/usr/bin/env python
# encoding: utf-8
"""
Show how to use `dur` and `delay` parameters of play() and out()
methods to sequence events over time.
"""
from pyo import *
import random
s = Server(duplex=0).boot()
num = 70
freqs = [random.uniform(100, 1000) for i in range(num)]
start1 = [i * 0.5 for i in range(num)]
fa... | belangeo/pyo | pyo/examples/sequencing/01_starttime_duration.py | Python | lgpl-3.0 | 1,118 |
# (C) British Crown Copyright 2020, 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) any la... | ocefpaf/cartopy | lib/cartopy/tests/conftest.py | Python | lgpl-3.0 | 1,159 |
#import printStatWithName
from AZutilities import dataUtilities
from AZutilities import paramOptUtilities
from trainingMethods import AZorngRF
from trainingMethods import AZorngCvSVM
import Orange
import orange
import math
import copy
import string
"""
Module for calculation of non conformity scores and the correspond... | JonnaStalring/AZOrange | azorange/AZutilities/TCPMondrian.py | Python | lgpl-3.0 | 33,237 |
# Copyright (c) 2010-2013 by Yaco Sistemas <goinnn@gmail.com> or <pmartin@yaco.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | shadow-identity/django-inplaceedit | inplaceeditform/settings.py | Python | lgpl-3.0 | 2,572 |
"""Driver module for Newport's Spectra-Physics Quanta-Ray INDI, PRO, and LAB
Series Nd:YAG lasers.
NOTE: the watchdog parameter is important! The laser will turn off if it does
not receive a command within the watchdog time period. Therefore, it is
advised to use a command like QRstatus().get_status() at regular int... | PALab/PLACE | place/plugins/quanta_ray/qray_driver.py | Python | lgpl-3.0 | 21,278 |
#!/usr/bin/python
import sys
import urllib2
RAINX_STAT_KEYS = [
("rainx.reqpersec", "total_reqpersec"),
("rainx.reqputpersec", "put_reqpersec"),
("rainx.reqgetpersec", "get_reqpersec"),
("rainx.avreqtime", "total_avreqtime"),
("rainx.avputreqtime", "put_avreqtime"),
("rainx.avgetreqtime", "get_avreqtime"),
]
... | redcurrant/redcurrant | svc-monitor/contrib/rainx-monitor.py | Python | lgpl-3.0 | 1,285 |
# -*- coding: utf-8 -*-
import unittest
from nose.tools import ok_, eq_, assert_equal, assert_false, assert_true, assert_raises
# noinspection PyUnresolvedReferences
from .._tins import EthernetII, HWAddress, PDU, IP, TCP, RAW, PDUNotFound, UDP, ICMP, OptionNotFound, DNS, DHCP, IPv4Address
import platform
IS_MACOSX =... | stephane-martin/cycapture | cycapture/libtins/tests/test_dhcp.py | Python | lgpl-3.0 | 7,257 |
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from datetime import datetime, timedelta
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
try:
from oauthlib import common as oauthlib_common
except:
pass
import uuid
class OauthApplication(models.Model):
CLIENT_ID_CHARACTER_SET = r'_-.:;... | thinkopensolutions/odoo-saas-tools | oauth_provider/models/oauth_provider.py | Python | lgpl-3.0 | 3,090 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from rbnics.utils.io import NumpyIO
def function_load(fun, directory, filename, suffix=None):
if suffix is not None:
filename = filename + "." + str(suffix)
file_exists = Nu... | mathLab/RBniCS | rbnics/backends/online/numpy/wrapping/function_load.py | Python | lgpl-3.0 | 485 |
# Copyright (C) 2016 VIB/BEG/UGent - Tim Diels <tim@diels.me>
#
# This file is part of pytil.
#
# pytil 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 opt... | timdiels/chicken_turtle_util | pytil/test.py | Python | lgpl-3.0 | 2,286 |
# -*- coding: utf-8 -*-
import pytest
from greek_stemmer.tools.text_tools import *
class TestParseText:
def test_parse_word_receives_no_string(self):
assert parse_word(None) == ''
# check accents removal and uppercase letters
parse_word_testdata = [
(' $', '$'),
(' foo ', 'FOO... | kpech21/Greek-Stemmer | tests/tools/test_text_tools.py | Python | lgpl-3.0 | 2,368 |
'''
PyPlato is set of batching utilies useful in HPC scheduling context
and shell (bash-like) automation in python.
Copyright (C) 2013 Yauhen Yakimovich
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 Foundat... | ewiger/plato | src/plato/__init__.py | Python | lgpl-3.0 | 1,105 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
INSTR_PER_LINE = 8
class Output(object):
def __init__(self):
pass
def output_text(self, tokens, outfile):
fd = open(outfile, 'w')
instr_counter = 0
for t in tokens:
instr = "%02X%02X%02X%02X" % tuple(reversed(t))
... | m-wichmann/pyArch | asm/src/output.py | Python | lgpl-3.0 | 572 |
#!/usr/bin/env python
"""
Deprecated since the solenoid was not strong enough.
Was using: https://www.sparkfun.com/products/11015
5v, 4.5mm throw
"""
# Import required libraries
import time
import RPi.GPIO as GPIO
# Use BCM GPIO references
# instead of physical pin numbers
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(Fal... | krimkus/stipplebot | solenoid.py | Python | unlicense | 1,215 |
## Cubieboard@Armbian plugin for temperature measurment
from libraries import utility
def plugin_main(json_arguments=None):
data="Undefned"
with open ("/sys/class/hwmon/hwmon0/device/temp1_input", "r") as temperature:
data=temperature.read()
return "{0} C".format(int(data)/1000)
| znoxx/tbng | engine/plugins/cputemp_cubie1.py | Python | unlicense | 292 |
# Taken from here: https://stackoverflow.com/questions/50566934/why-is-this-singleton-implementation-not-thread-safe
import functools
import threading
lock = threading.Lock()
def synchronized(lock):
""" Synchronization decorator """
def wrapper(f):
@functools.wraps(f)
def inner_wrapper(*args... | cinepost/Copperfield_FX | copper/core/utils/singleton.py | Python | unlicense | 849 |
# Copyright (C) 2016 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd... | netsamir/dotfiles | files/vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/tests/go/__init__.py | Python | unlicense | 2,316 |
import requests
from bs4 import BeautifulSoup
import unittest
import numpy.testing as npt
import unicodedata
from selenium import webdriver
# from selenium.webdriver.support.ui import WebDriverWait
import os
import time
from tabulate import tabulate
import linkcheck_helper
phantomjs_path = "C://Python27//Lib//site-pac... | puruckertom/qed_tests | tests/testing_ground.py | Python | unlicense | 14,478 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
int_or_none,
parse_age_limit,
parse_iso8601,
)
class Go90IE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?go90\.com/videos/(?P<id>[0-9a... | epitron/youtube-dl | youtube_dl/extractor/go90.py | Python | unlicense | 5,640 |
#!/usr/bin/env python
# Copyright 2017 Google 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 a... | cschnei3/forseti-security | tests/enforcer/enforcer_test.py | Python | apache-2.0 | 4,766 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jlongever/redfish-client-python | on_http_redfish_1_0/models/computer_system_1_0_0_system_type.py | Python | apache-2.0 | 2,513 |
# 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, ... | google-research/fitvid | metrics.py | Python | apache-2.0 | 3,220 |
from collections import namedtuple
import io
import re
from six.moves.urllib.parse import urlparse
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.deployment_manager import dm_base
from ruamel.yaml import YAML
DM_OUTPUT_QUERY_REGEX = re.compile(
r'!DMOutput\s+(?P<url>\bd... | aljim/deploymentmanager-samples | community/cloud-foundation/src/cloud_foundation_toolkit/dm_utils.py | Python | apache-2.0 | 3,240 |
# 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 use ... | stewnorriss/LibCloud | libcloud/compute/drivers/ec2.py | Python | apache-2.0 | 194,697 |
# coding: utf-8
import wolframalpha
from .exceptions import APIError
from .clients import turingclient, baiduclient
from .utils import get_mac_address, get_audio_info
class Wolfram(object):
"""A client for request Wolfram.
Attributes:
key: The key string got from https://www.wolframalpha.com.
"""... | namco1992/voicetools | voicetools/api.py | Python | apache-2.0 | 4,729 |
# 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... | kevin-coder/tensorflow-fork | tensorflow/python/distribute/parameter_server_strategy.py | Python | apache-2.0 | 22,870 |
from twisted.words.protocols.irc import ERR_NORECIPIENT, ERR_NOTEXTTOSEND, ERR_NOSUCHNICK
class Command(object):
"""
PRIVMSG is used to send private messages between users, as well as to
send messages to channels. <msgtarget> is usually the nickname of
the recipient of the message, or a channel name.... | kevelbreh/betternet | betternet/command/privmsg.py | Python | apache-2.0 | 3,895 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Huyuwei/tvm | python/tvm/autotvm/task/topi_integration.py | Python | apache-2.0 | 19,668 |
"""
Django signals for the app.
"""
import logging
from django.db.models.signals import post_save
from django.conf import settings
from django.contrib.sites.models import Site
from .models import Response, UnitLesson
from .ct_util import get_middle_indexes
from core.common.mongo import c_milestone_orct
from core.com... | cjlee112/socraticqs2 | mysite/ct/signals.py | Python | apache-2.0 | 5,199 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | rahulunair/nova | nova/conductor/tasks/base.py | Python | apache-2.0 | 1,651 |
#!/usr/bin/python
# coding=utf-8
# Copyright 2012-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | amidvidy/mongo-orchestration | mongo_orchestration/sharded_clusters.py | Python | apache-2.0 | 18,384 |
#!/usr/bin/env python
"""
Calculate entropies of each leaf on each branch node of a tree for each column
Usage:
entropy.py -a ali.s9t100.fa -n gpcrdb_gapped_tm_numbering.csv -t ali.s9t100.ph > ali.s9t100.entropies
"""
import argparse
import collections
import logging
import math
from Bio import Phylo, AlignIO
im... | 3D-e-Chem/snooker-alignment | scripts/entropy.py | Python | apache-2.0 | 4,710 |
from collections import OrderedDict
from django.contrib.auth.models import AnonymousUser
from rest_framework_json_api import serializers
from share import models
from share.models import ChangeSet, ProviderRegistration, CeleryProviderTask
class ShareModelSerializer(serializers.ModelSerializer):
# http://stacko... | zamattiac/SHARE | api/serializers.py | Python | apache-2.0 | 4,542 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 o... | facebook/fbthrift | thrift/lib/py/async_common.py | Python | apache-2.0 | 14,364 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | xodus7/tensorflow | tensorflow/python/estimator/estimator.py | Python | apache-2.0 | 89,962 |
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
@login_required(login_url='/accounts/login/')
def home(request):
return render(request, "base/index.html", {})
def home_files(request, filename):
return render(request, filename, {}, content_t... | MVilstrup/Django-Base | Base/views.py | Python | apache-2.0 | 339 |
#
# Copyright (c) 2021 Project CHIP 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 applica... | project-chip/connectedhomeip | src/controller/python/chip/setup_payload/setup_payload.py | Python | apache-2.0 | 4,568 |
# Copyright (c) 2018 PaddlePaddle 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 app... | kuke/models | fluid/PaddleNLP/text_classification/async_executor/data_generator/data_generator.py | Python | apache-2.0 | 22,716 |
"""
A job is an object with states: CREATED, RUNNING, DONE, FAILED, CANCELLED
A job can be polled for completion and reports the progress so far if it is still RUNNING.
"""
from connection import H2OConnection
import time
import sys
class H2OJob(object):
"""
A class representing an H2O Job.
"""
def __init__(... | bikash/h2o-dev | h2o-py/h2o/job.py | Python | apache-2.0 | 2,183 |
# coding=utf-8
"""
Ingest data from the command-line.
"""
from __future__ import absolute_import, division
import uuid
import logging
from xml.etree import ElementTree
from pathlib import Path
import yaml
import click
from osgeo import gdal, osr
from dateutil import parser
def get_coords(geo_ref_points, spatial_ref)... | ceos-seo/Data_Cube_v2 | agdc-v2/utils/modisprepare.py | Python | apache-2.0 | 5,331 |
#!/usr/bin/env python
#encoding=utf8
'''
Author: xmuyoo@163.com
Date: 2015/12/04
Content:
生成新闻特征数据
输入:
1、无特征样本数据
2、topic_view的文件
3、文章分词过滤后的文件
输出:
1、特征样本数据
'''
import pdb
from collections import Counter
DATA_DIR = 'tmp_data/topic_train'
MAX_SCORE = 10.0
MIN_WORDS_COUNT = 3
T... | Muyoo/gold_pred | feature_creator/news.py | Python | apache-2.0 | 3,497 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | leilihh/novaha | nova/cert/manager.py | Python | apache-2.0 | 2,464 |
import numpy as np
import numpy.ma as ma
from numpy import linalg as LA
import matplotlib.pyplot as plt
import itertools
import collections
from scipy import stats
def acf(x, lags=500, exclude=None):
if exclude is None:
exclude = np.zeros(x.shape)
exclude = np.cumsum(exclude.astype(int))
# from s... | stephenhelms/WormTracker | python/tsstats.py | Python | apache-2.0 | 8,100 |
# Copyright (c) 2015, MapR Technologies
#
# 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... | esikachev/scenario | sahara/plugins/mapr/plugin.py | Python | apache-2.0 | 2,850 |
# -*- coding: utf-8 -*-
from django.http import HttpResponse, HttpRequest, QueryDict, HttpResponseRedirect
import json
import conekta
from store.models import *
from store.forms import *
### PETICIONES API PARA EL CARRITO
def delBasket(request):
id = str(request.GET.get('id'))
if request.GET.ge... | zeickan/Django-Store | store/api.py | Python | apache-2.0 | 3,203 |
import logging
from .data import DefinedTable
logger = logging.getLogger(__name__)
def ensure_tables():
"""When called, ensure that all the tables that we need are created in the
database. The real work is supplied by the DefinedTable base class
"""
for tab in [Subject, ExpCondition]:
logge... | memphis-iis/demo-track | demotrack/model.py | Python | apache-2.0 | 1,712 |
import hashlib
f = open('file_path', 'rb')
sh = hashlib.sha256()
sh.update(f.read())
print(sh.hexdigest())
f.close() | fanwenl/kindle-image | encryption/sha.py | Python | apache-2.0 | 119 |
from tableacc import TableAcc
class Brewers(TableAcc):
def __init__(self):
super(Brewers, self).__init__(
table_name='brewers',
cols=['id', 'name', 'location_id'],
upsert_proc='brewerupsert')
def bylocation_id(self, location_id, order_by=""):
return self._select(
cols=["i... | robhowley/nextbeeronme | src/db/brewers.py | Python | apache-2.0 | 753 |
# -*- encoding: utf-8 -*-
import pytest
from django.utils import timezone
from base.model_utils import BaseError
from example_base.models import FruitCake
from login.tests.factories import UserFactory
from .factories import FruitCakeFactory
@pytest.mark.django_db
def test_factory():
FruitCakeFactory()
@pytest... | pkimber/base | example_base/tests/test_model_versioned_delete.py | Python | apache-2.0 | 2,006 |
# -*- coding: utf-8 -*-
# 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... | googleads/google-ads-python | google/ads/googleads/v9/errors/types/ad_parameter_error.py | Python | apache-2.0 | 1,192 |
from __future__ import print_function
from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..","..",".."))
import h2o
from h2o.automl import H2OAutoML
from tests import pyunit_utils as pu
from _automl_utils import import_dataset
def test_default_automl_with_regression_task():
... | h2oai/h2o-3 | h2o-py/tests/testdir_algos/automl/pyunit_automl_regression.py | Python | apache-2.0 | 1,901 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 25 21:46:31 2017
@author: sitibanc
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# =============================================================================
# Read CSV
# =============================================... | SitiBanc/1061_NCTU_IOMDS | 1025/Homework 5/HW5_2.py | Python | apache-2.0 | 6,016 |
#!/usr/bin/python
import os
import requests
from collections import defaultdict
from glob import glob
def convert(dpi, equation):
url = 'http://latex.codecogs.com/png.latex?'
r = requests.get(url, params='\dpi{' + str(dpi) + '} ' + equation)
print('HTTP response: ' + str(r.status_code))
if (r.status_... | fodpeter/MathClock | equations/build.py | Python | apache-2.0 | 2,085 |
# Copyright 2013 Rackspace Hosting
# 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 require... | HybridF5/jacket | jacket/api/compute/openstack/compute/instance_actions.py | Python | apache-2.0 | 4,402 |
from mpi4py import MPI
from utils.mpi_helper import finalize
from utils.mpi_helper import init
init()
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
print "process [", rank, "] - running"
if rank == 0:
data = {'name': "PROCESS-" + str(rank), 'msg': "Hello"}
req = comm.isend(data, dest=... | balolam/university-mpi-python | practical_task_1/task2.py | Python | apache-2.0 | 516 |
import profile
def fib(n):
# from literateprograms.org
# http://bit.ly/hlOQ5m
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
def fib_seq(n):
seq = []
if n > 0:
seq.extend(fib_seq(n - 1))
seq.append(fib(n))
return seq... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_developer_tools/profile_fibonacci_raw.py | Python | apache-2.0 | 367 |
from cstool.parse_input import (read_input, check_settings, cstool_model)
from cstool.phonon import (phonon_cs_fn)
from cslib import (units)
import numpy as np
def test_phonon_cs_fn_single():
"""Tests that the phonon subroutine returns a function that
can handle arrays and returns correct units."""
settin... | eScatter/cstool | test/test_phonon.py | Python | apache-2.0 | 1,357 |
"""Executor util helpers."""
from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
import contextlib
import logging
import queue
import sys
from threading import Thread
import time
import traceback
from .thread import async_raise
_LOGGER = logging.getLogger(__name__)
MAX_LOG_ATTEMPTS ... | home-assistant/home-assistant | homeassistant/util/executor.py | Python | apache-2.0 | 3,555 |
#
# Copyright 2016 Dohop hf.
#
# 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, ... | dohop/supervisor-logstash-notifier | setup.py | Python | apache-2.0 | 1,635 |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | crate/crate-python | src/crate/client/sqlalchemy/tests/connection_test.py | Python | apache-2.0 | 2,183 |
import logging
from json import JSONEncoder, dumps
from flask import current_app, make_response, request
__all__ = (
"serialize",
"jsonify",
)
log = logging.getLogger(__name__)
def serialize(rv):
log.debug("Serializing output")
if rv is None or (isinstance(rv, str) and not len(rv)):
log.in... | pegasus-isi/pegasus | packages/pegasus-python/src/Pegasus/service/_serialize.py | Python | apache-2.0 | 1,770 |
# Copyright 2020 Makani Technologies 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... | google/makani | gs/monitor2/apps/plugins/layouts/debug_hover_layout.py | Python | apache-2.0 | 909 |
#!/usr/bin/python
from setuptools import setup
setup(
name = "dhcpz",
version = "0.2.0",
author = [
"Nicholas VonHollen",
"Brian Lamar"
],
author_email = [
"nicholas.vonhollen@rackspace.com",
"brian.lamar@rackspace.com",
],
... | blamarvt/dhcpz | setup.py | Python | apache-2.0 | 662 |
"""
WSGI config for tweeter project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | pananormalny/mytweeter | tweeter/wsgi.py | Python | apache-2.0 | 391 |
#
# 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 us... | nchammas/spark | python/pyspark/sql/udf.py | Python | apache-2.0 | 21,985 |
""" config.py """
import os
from flask import Flask
from peewee import MySQLDatabase, SqliteDatabase
#-------------------------------------------------------------------------------
# Environment
#-------------------------------------------------------------------------------
DB = 'idreamoftoast'
ENV = os.... | whiskeylover/idreamoftoast | toast/config.py | Python | apache-2.0 | 1,878 |
# Copyright 2010 OpenStack Foundation
# Copyright 2012 University Of Minho
#
# 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.... | cloudbase/nova | nova/tests/unit/virt/libvirt/test_driver.py | Python | apache-2.0 | 828,674 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import DataCodec
from hazelcas... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/list_get_codec.py | Python | apache-2.0 | 944 |