code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
##############################################################################
#
# Mandate module for openERP
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# @author: Cyril Sester <csester@compassion.ch>,
# Alexis de Lattre <alexis.delattre@akretion.com... | noemis-fr/custom | account_banking_natixis_direct_debit/models/payment_line.py | Python | gpl-3.0 | 1,722 |
"""Geo sub-package of Mobile Security & Privacy Simulator.
This sub-package contains all geo-related code.""" | bhenne/MoSP | mosp/geo/__init__.py | Python | gpl-3.0 | 110 |
#!/usr/bin/python
#
# Compares vmstate information stored in JSON format, obtained from
# the -dump-vmstate QEMU command.
#
# Copyright 2014 Amit Shah <amit.shah@redhat.com>
# Copyright 2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | mwhudson/qemu | scripts/vmstate-static-checker.py | Python | gpl-2.0 | 12,817 |
import pytest
from pages.treeherder import Treeherder
RESULTS = ['testfailed', 'busted', 'exception']
@pytest.fixture
def test_jobs(eleven_job_blobs, create_jobs):
for i, status in enumerate(RESULTS):
eleven_job_blobs[i]['job']['result'] = status
return create_jobs(eleven_job_blobs[0:len(RESULTS)])
... | edmorley/treeherder | tests/selenium/test_filter_jobs_by_failure_result.py | Python | mpl-2.0 | 1,003 |
# -*- coding: utf-8 -*-
from distutils.core import setup
from pyrobotics.BB import __version__
setup(name='pyRobotics',
version=__version__,
author='Adrián Revuelta Cuauhtli',
author_email='adrianrc.89@gmail.com',
url='http://bioroboticsunam.github.io/pyRobotics',
license='LICENSE.txt',
data_fil... | BioRoboticsUNAM/pyRobotics | setup.py | Python | mit | 513 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/PyInstaller/hooks/hook-matplotlib.py | Python | gpl-3.0 | 591 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
class BaseRunner(object):
"""
The runner represents a connecting layer between the solver and the machine learning model.
Responsible for communicating with the model with a data batch: prepare, train, evaluate.
"""
def build_model(self):... | maxim5/hyper-engine | hyperengine/model/base_runner.py | Python | apache-2.0 | 1,183 |
import unittest
import os
import sys
import shutil
sys.path.append('../lib/')
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
import alchemy
from alchemy.schema import *
class TestAlchemy(unittest.TestCase):
def setUp(self):
# this basically resets our testing database
path = config.... | yngcan/patentprocessor | test/test_alchemy.py | Python | bsd-2-clause | 14,826 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
extentSelector.py
---------------------
Date : December 2010
Copyright : (C) 2010 by Giuseppe Sucameli
Email : brush dot tyler at gmail dot com
*********... | sebastic/QGIS | python/plugins/GdalTools/tools/extentSelector.py | Python | gpl-2.0 | 7,376 |
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, func, Index, Integer, select, String, text
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import column_property, relationship
from radar.auth.passwords import check_password_hash, ... | renalreg/radar | radar/models/users.py | Python | agpl-3.0 | 4,448 |
# Copyright 2014 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 imp
import os.path
import sys
from mojom import fileutil
from mojom.error import Error
fileutil.AddLocalRepoThirdPartyDirToModulePath()
from ply.lex... | chromium/chromium | mojo/public/tools/mojom/mojom/parse/lexer.py | Python | bsd-3-clause | 5,808 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "greengov2015.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jthidalgojr/greengov2015-TeamAqua | manage.py | Python | mit | 255 |
"""
progressbar.py
A Python module with a ProgressBar class which can be used to represent a
task's progress in the form of a progress bar and it can be formated in a
basic way.
Here is some basic usage with the default options:
>>> from progressbar import ProgressBar
>>> p = ProgressBar()
>>> print... | RohanArora13/Hook | progressbar.py | Python | mit | 3,815 |
#
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of data model for mesos manager
"""
import json
from cfgm_common.vnc_db import DBBase
from bitstring import BitArray
from vnc_api.vnc_api import (KeyValuePair)
from mesos_manager.vnc.vnc_mesos_config import VncM... | rombie/contrail-controller | src/container/mesos-manager/mesos_manager/vnc/config_db.py | Python | apache-2.0 | 32,110 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_baseline_operations.py | Python | mit | 9,160 |
from distutils.core import setup
setup(name='ePowerSwitch',
version='1.0',
py_modules=['ePowerSwitch'],
)
| bajo/ePowerSwitch | setup.py | Python | gpl-2.0 | 118 |
# Wrapper module for waagent
#
# waagent is not written as a module. This wrapper module is created
# to use the waagent code as a module.
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Yo... | andyliuliming/azure-linux-extensions | VMBackup/main/Utils/WAAgentUtil.py | Python | apache-2.0 | 3,173 |
import numpy as np
from pycuda import driver, compiler, gpuarray, tools
# -- initialize the device
import pycuda.autoinit
kernel_code_template = """
__global__ void MatrixMulKernel(float *a, float *b, float *c)
{
int tx = threadIdx.x;
int ty = threadIdx.y;
float Pvalue = 0;
for (int k = 0;... | IdiosyncraticDragon/Reading-Notes | Python Parallel Programming Cookbook_Code/Chapter 6/PyCUDA/PyCudaMatrixManipulation.py | Python | apache-2.0 | 1,480 |
# python imports
from os import path
import simplejson as json
# library imports
from werkzeug import Response
from werkzeug.exceptions import Forbidden
from mako.lookup import TemplateLookup
from formencode import Invalid
from formencode.variabledecode import variable_decode
# local imports
from ..utils.utils import s... | ubunteroz/foreman | foreman/controllers/baseController.py | Python | gpl-3.0 | 21,061 |
"""Unit tests for the driving_license module."""
import datetime
import typing
import unittest
from bob_emploi.frontend.api import geo_pb2
from bob_emploi.frontend.api import boolean_pb2
from bob_emploi.frontend.server.test import scoring_test
class DrivingLicenseHelpScoringModelTestCase(scoring_test.ScoringModelTe... | bayesimpact/bob-emploi | frontend/server/modules/test/driving_license_test.py | Python | gpl-3.0 | 14,248 |
""" test File Plugin
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import mock
import unittest
import tempfile
import os
import shutil
import errno
from DIRAC import S_OK
from DIRAC.Resources.Storage.StorageElement import StorageElementItem
def mock... | ic-hep/DIRAC | src/DIRAC/Resources/Storage/test/Test_FilePlugin.py | Python | gpl-3.0 | 18,616 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-03-05 16:47
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ticketing', '0001_initial'),
]
operations = [
... | himadriganguly/featurerequest | ticketing/migrations/0002_auto_20160305_1647.py | Python | gpl-3.0 | 1,432 |
# coding: utf-8
from websocket import create_connection
def ws_handler():
ws = create_connection("ws://localhost:8000/echo")
try:
# ws.send("Hello, world")
while 1:
result = ws.recv()
print(result)
except:
pass
finally:
ws.close()
# with crea... | fpagyu/glory | pi/client.py | Python | mit | 500 |
#!/usr/bin/python
""" PN CLI vrouter-create/vrouter-delete/vrouter-modify """
#
# 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
#... | t0mk/ansible | lib/ansible/modules/network/netvisor/pn_vrouter.py | Python | gpl-3.0 | 13,328 |
#!/usr/bin/env python
from __future__ import unicode_literals
from setuptools import setup
setup(
name='xcache',
version='0.2',
description='clean caches when needed',
author='Sven R. Kunze',
author_email='srkunze@mail.de',
url='https://github.com/srkunze/xcache',
license='MIT',
class... | srkunze/xcache | setup.py | Python | mit | 573 |
## This file is part of Invenio.
## Copyright (C) 2010, 2011 CERN.
##
## Invenio 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.
##
... | Panos512/invenio | modules/miscutil/lib/plotextractor_config.py | Python | gpl-2.0 | 1,037 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify,... | lucalianas/ProMort | promort/clinical_annotations_manager/migrations/0008_auto_20170405_0826.py | Python | mit | 2,509 |
#
#+ Copyright (c) 2014, 2015 Rikard Lindstrom <ornotermes@gmail.com>
#
# 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.
... | ornotermes/WebLights | effects/Fading glitter.py | Python | gpl-3.0 | 2,085 |
from ckan.common import c
from ckanext.ytp.request.helper import get_user_member
import logging
log = logging.getLogger(__name__)
def _member_common_access_check(context, data_dict, status):
if not c.userobj:
return {'success': False}
organization_id = data_dict.get("organization_id")
if not orga... | yhteentoimivuuspalvelut/ckanext-ytp-request | ckanext/ytp/request/logic/auth/delete.py | Python | agpl-3.0 | 887 |
#!/bin/python3
import sys
S = input().strip()
try:
S = int(S)
print(int(S))
except ValueError:
print("Bad String") | kyle8998/Practice-Coding-Questions | hackerrank/30-days-of-code/day-16.py | Python | unlicense | 140 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-talent | samples/generated_samples/jobs_v4beta1_generated_profile_service_get_profile_sync.py | Python | apache-2.0 | 1,440 |
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from django.contrib.auth.models import User
from core.db.manager import DataHubManager
import random
import string
from collections import namedtuple
def random_slug(length):
return ''.join(
... | datahuborg/datahub | src/integration_tests/test_api_endpoints.py | Python | mit | 13,248 |
from django import forms
from .models import Page
class PageForm(forms.ModelForm):
class Meta:
model = Page
fields = ["content", "language", "path"]
widgets = {
"language": forms.HiddenInput(),
"path": forms.HiddenInput(),
}
| osmfj/django-restcms | restcms/forms.py | Python | bsd-2-clause | 289 |
from pos.models.user import User, UserSession
from rest_framework import serializers
class CrewSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('first_name', 'last_name', 'credit', 'card', 'is_cashier')
class CrewSessionSerializer(serializers.ModelSerializer):
c... | nuxis/p0sX-server | p0sx/pos/serializers/user.py | Python | mit | 400 |
import json
import logging
import os
import sys
import socket
import six
from lymph.exceptions import RegistrationFailure, SocketNotCreated
from lymph.core.components import Componentized
from lymph.core.events import Event
from lymph.core.monitoring import metrics
from lymph.core.monitoring.pusher import MonitorPush... | alazaro/lymph | lymph/core/container.py | Python | apache-2.0 | 7,867 |
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... | googleinterns/av1-codec-comparison | rtc-video-quality/encoder_commands.py | Python | apache-2.0 | 15,457 |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
import os,sys
import urllib
############################
# COMMAND LINE INTERFACE #
############################
import argparse
parser = argparse.ArgumentParser(description="Morfix wrapper for console")
parser.add_argument("-v", "--verbose", help="Make the output v... | alejandrogallo/dotfiles | bin/heb.py | Python | unlicense | 1,495 |
import logging
import datetime
import pymysql
from urllib.parse import urlsplit
log = logging.getLogger('tyggbot')
class LinkTrackerLink:
@classmethod
def load(cls, cursor, url):
link = cls()
cursor.execute('SELECT * FROM `tb_link_data` WHERE `url`=%s', [url])
row = cursor.fetchone()... | 0rmi/tyggbot | models/linktracker.py | Python | mit | 2,792 |
# -*- 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... | StefanRijnhart/odoo | addons/stock/stock.py | Python | agpl-3.0 | 253,130 |
import curses
import functools
from stem.control import EventType, Controller
from stem.util import str_tools
# colors that curses can handle
COLOR_LIST = {
"red": curses.COLOR_RED,
"green": curses.COLOR_GREEN,
"yellow": curses.COLOR_YELLOW,
"blue": curses.COLOR_BLUE,
"cyan": curses.COLOR_CYAN,
"magenta"... | tparks5/tor-stem | docs/_static/example/event_listening.py | Python | lgpl-3.0 | 5,286 |
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.cross_validation import train_test_split, cross_val_score
from sklearn.metrics import classification_report, confusion_matrix
from imblearn.under_sampling import RandomUnderSampler
imp... | brityboy/BotBoosted | src/classification_model.py | Python | mit | 7,022 |
# -*- coding: utf-8 -*-
import os
import os.path
import sys
import re
import time
import math
import shutil
import calendar
import boto.ec2
import boto.ec2.blockdevicemapping
import boto.ec2.networkinterface
from nixops.backends import MachineDefinition, MachineState
from nixops.nix_expr import Function, Call, RawValu... | fpletz/nixops | nixops/backends/ec2.py | Python | lgpl-3.0 | 62,815 |
__all__ = ["zeroSR1"]
import numpy as np
import scipy.linalg
import datetime
def zeroSR1(fcnGrad, h, prox, options):
"""
ZEROSR1 Solves smooth + nonsmooth/constrained optimization problems
xk,nit, stepSizes = zeroSR1(fcnGrad, h, prox_h, opts)
This uses the zero-memory SR1 method (quasi-Newton) to solve:
min_x ... | aasensio/pyzeroSR1 | pyzeroSR1/zeroSR1.py | Python | mit | 6,583 |
# Python program for implementation of Selection
# Sort
import sys
A = [64, 25, 12, 22, 11]
# Traverse through all array elements
for i in range(len(A)):
# Find the minimum element in remaining
# unsorted array
min_idx = i
for j in range(i+1, len(A)):
if A[min_idx] > A[j]:
min_idx = j
# Swap the found... | Harnek/algorithms | Sorting/SelectionSort.py | Python | mit | 500 |
import sys # this allows you to read the user input from keyboard also called "stdin"
import classOne # This imports all the classOne functions
import classTwo # This imports all the classTwo functions
import classThree # This imports all the classThree functions
import classFour # This imports all the classFour fun... | nischal2002/m-quiz-2016 | quiz.py | Python | mit | 1,704 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# find_Drive.py
# Created on: 2014-09-08
# Description: Unzips or zips a directory
# ---------------------------------------------------------------------------
# This script is zips/unzips a di... | borchert/metadata-tools | general/zipUnzip.py | Python | mit | 1,713 |
#!/usr/bin/python
# 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
# "Licens... | segfault/apache_cassandra | drivers/py/setup.py | Python | apache-2.0 | 1,564 |
# Based on iwidgets2.2.0/tests/entryfield.test code.
import tkinter
import Test
import Pmw
Test.initialise()
_myValidators = {
'hello' : (lambda s: s == 'hello', len),
}
c = Pmw.EntryField
kw_1 = {'entry_width' : 12, 'labelpos' : 'n', 'label_text' : 'Entry Field:'}
tests_1 = (
(c.pack, (), {'... | wolf29f/iCook | iCook/Pmw/Pmw_2_0_0/tests/EntryField_test.py | Python | gpl-2.0 | 3,257 |
#!/usr/bin/python3
# ------------------------------------------------------------------------------
# Python
import os
# ------------------------------------------------------------------------------
def gen_salt(length=512):
uran = os.urandom(length)
return uran.hex()
| der-Daniel/Alohomora-Python | app/salt.py | Python | gpl-2.0 | 283 |
from django.db import models
from django.contrib.auth.models import User
class Tag(models.Model):
name = models.CharField(max_length=250)
owner = models.ForeignKey(User)
def __unicode__(self):
return self.name
class Family(models.Model):
husband_name = models.CharField('Husband: Name', max_l... | bencrowder/gent | gent/models.py | Python | mit | 2,368 |
'''
Created on Nov 27, 2015
@author: ionut
'''
def ip2int(ip):
o = map(int, ip.split('.'))
if len(o) > 4:
raise Exception('invalid input')
for d in o:
if d < 0:
raise Exception('invalid input')
if d > 255:
raise Exception('invalid input')
res = (1677721... | iticus/iplocpy | utils.py | Python | mit | 779 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# 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
# License, or (at your option) any later version.
#
# This progra... | astagi/taiga-back | taiga/projects/history/models.py | Python | agpl-3.0 | 9,174 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | SKIRT/PTS | modeling/simulation/__init__.py | Python | agpl-3.0 | 694 |
"""
Analysis of the performance of two clustering methods
on various subsetsof our county-level cancer risk data set.
In particular, we will compare these two clustering methods in three areas:
* Efficiency - Which method computes clusterings more efficiently?
* Automation - Which method requi... | MohamedAbdultawab/FOC_RiceUniv | algorithmic-thinking-2/module-3-project-and-application/02_application-3-comparison-of-clustering-algorithms/Q1_using_timeit.py | Python | gpl-3.0 | 1,860 |
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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.
#
#... | tiancj/emesene | emesene/gui/qt4ui/widgets/ChatInput.py | Python | gpl-3.0 | 11,377 |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from rest_framework import permissions
class EmailPermissions(permissions.IsAuthenticated):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
... | glomium/elmnt.de | useraccounts/permissions.py | Python | mit | 597 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018, Eric Jacob <erjac77@gmail.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/LICENS... | GabrielFortin/ansible-module-f5bigip | library/f5bigip_ltm_profile_client_ssl.py | Python | apache-2.0 | 16,293 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['LinearTrend'] , ['Seasonal_DayOfMonth'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_LinearTrend_Seasonal_DayOfMonth_SVR.py | Python | bsd-3-clause | 160 |
from ingenico.connect.sdk.data_object import DataObject
from ingenico.connect.sdk.domain.dispute.dispute_response import DisputeResponse
from ingenico.connect.sdk.domain.payment.payment_response import PaymentResponse
from ingenico.connect.sdk.domain.refund.refund_response import RefundResponse
from ingenico.connect.sd... | Ingenico-ePayments/connect-sdk-python2 | ingenico/connect/sdk/domain/webhooks/web_hooks_event.py | Python | mit | 5,274 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import urllib2
from util.global_def import get_msg
from util.message import Msg
def check_access_status():
print(get_msg(Msg.check_network_connection))
try:
urllib2.urlopen('http://google.com', timeo... | r-kan/reminder | util/network.py | Python | mit | 759 |
"""
Return types from api classes interface for the SOAP kegg api.
"""
from datetime import datetime
from collections import namedtuple
from operator import methodcaller
Definition = namedtuple(
"Definition",
["entry_id",
"definition"]
)
def _Definition_from_items(items):
""" Definition 'items' tu... | tomazc/orange-bio | orangecontrib/bio/kegg/types.py | Python | gpl-3.0 | 3,716 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2018 CERN.
#
# INSPIRE 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... | inspirehep/inspire-next | inspirehep/modules/refextract/matcher.py | Python | gpl-3.0 | 4,916 |
import logging
import functools
import collections
import idna
import regex
import unicodedata
import synapse.exc as s_exc
import synapse.data as s_data
import synapse.lib.crypto.coin as s_coin
logger = logging.getLogger(__name__)
tldlist = list(s_data.get('iana.tlds'))
tldlist.extend([
'bit',
'onion',
])... | vertexproject/synapse | synapse/lib/scrape.py | Python | apache-2.0 | 14,179 |
# -*- coding: utf-8 -*-
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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 L... | pculture/unisubs | apps/subtitles/shims.py | Python | agpl-3.0 | 1,976 |
class ZillowError(Exception):
def __init__(self, response):
super(ZillowError, self).__init__(
"There was a problem with your request. Status code {}, Content {}".
format(response.status_code, response.content)
)
| ahlusar1989/flowzillow | flowzillow/exceptions.py | Python | gpl-2.0 | 259 |
import os
import pytest
from pkgstack.profile import Profile
TESTS_PATH = os.path.realpath(os.path.dirname(__file__))
def test_profile_create():
config = Profile(os.path.join(TESTS_PATH, 'resources/sample.yml')).config
assert config == [
{'install': 'pytest', 'stage': 'test'},
{'name': 'In... | ownport/pkgstack | tests/test_profile.py | Python | mit | 1,807 |
# import pydrakeik first. This is a workaround for the issue:
# https://github.com/RobotLocomotion/director/issues/467
from director import pydrakeik
import director
from director import robotsystem
from director.consoleapp import ConsoleApp
from director import transformUtils
from director import robotstate
from dir... | patmarion/director | src/python/tests/testEndEffectorIk.py | Python | bsd-3-clause | 6,875 |
from __future__ import absolute_import
from typing import Any, Iterable, Mapping, Optional, Set, Tuple
from six import text_type
from zerver.lib.initial_password import initial_password
from zerver.models import Realm, Stream, UserProfile, Huddle, \
Subscription, Recipient, Client, get_huddle_hash, email_to_domain... | joyhchen/zulip | zerver/lib/bulk_create.py | Python | apache-2.0 | 6,505 |
import json
import random
import subprocess
import sys
import opt_bug_reducer
import swift_tools
def random_bug_finder(args):
"""Given a path to a sib file with canonical sil, attempt to find a perturbed
list of passes that the perf pipeline"""
tools = swift_tools.SwiftTools(args.swift_build_dir)
config... | tardieu/swift | utils/bug_reducer/bug_reducer/random_bug_finder.py | Python | apache-2.0 | 3,006 |
import sideboard
| migetman9/ubersystem | conftest.py | Python | agpl-3.0 | 17 |
import os
import bpy
from bpy.props import *
bl_info = {
"name": "PMK PBR Materials",
"author": "Karol Wajs",
"version": (0, 0, 1),
"blender": (2, 7, 6),
"location": "Viewport",
"description": "Adds panel in material properties that allows editing material PBR properties.",
"category": "Mat... | DezerteR/PMK-Blender-Scripts | PMK_PBRMaterialProperties.py | Python | mit | 2,250 |
#!/usr/bin/env python
"""
Select a source file, then view it with syntax highlighting.
"""
import argparse
import subprocess
import sys
try:
import tkFileDialog
except ImportError:
try:
from tkinter import filedialog as tkFileDialog
except:
pass
from cjh.cli import Fileman
from cjh.config ... | hammerhorn/hammerhorn-jive | cloop/cats/view.py | Python | gpl-2.0 | 2,314 |
"""Standard typecasts for Nengo on SpiNNaker."""
import rig.type_casts as tp
value_to_fix = tp.float_to_fix(True, 32, 15) # Float -> S16.15
fix_to_value = tp.fix_to_float(True, 32, 15) # S16.15 -> Float
np_to_fix = tp.NumpyFloatToFixConverter(True, 32, 15) # Float -> S16.15
fix_to_np = tp.NumpyFixToFloatConverter... | project-rig/nengo_spinnaker | nengo_spinnaker/utils/type_casts.py | Python | mit | 343 |
#!/usr/bin/python -u
import subprocess
from time import sleep, strftime
import os, sys, fcntl, signal
import json, urllib2, tempfile
from datetime import datetime, timedelta, date
import optparse
import ConfigParser
import errno
done = False
run_now = False
STATS_STR = {'NEW DB ENTRIES':'new_entries', 'SUCCESSFUL MATC... | dodkoC/webCrawler | bin/webCrawler_sched.py | Python | gpl-3.0 | 11,112 |
def extractTsuigeki(item):
"""
# Tsuigeki Translations
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Seiju no Kuni no Kinju Tsukai' in item['tags'] and (chp or vol):
return buildReleaseMessageWithType(i... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractTsuigeki.py | Python | bsd-3-clause | 410 |
# module_interface.py, part of Rubber building system for LaTeX documents..
# Copyright (C) 2015-2015 Nicolas Boulenguez <nicolas.boulenguez@free.fr>
# 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 Founda... | oracleyue/rubber-for-latex | src/module_interface.py | Python | gpl-2.0 | 3,888 |
from contextlib import suppress
from .controller import Controller
from ..protocol.proto.main_pb2 import Robot as RobotMessage, BaseStation
from ..util import get_config
import asyncio
import websockets
import logging
from sys import stdout
logger = logging.getLogger(__name__)
class Component(object):
def __init... | ksurct/MercuryRoboticsEmbedded2016 | ksurobot/basestation/__init__.py | Python | apache-2.0 | 4,654 |
# Copyright (c) 2012 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.
"""Centralize knowledge about how to create standardized Google Storage paths.
This includes definitions for various build flags:
SKIP - means a g... | mxOBS/deb-pkg_trusty_chromium-browser | third_party/chromite/lib/paygen/gspaths.py | Python | bsd-3-clause | 26,101 |
"""Map Comprehensions"""
def inverse_filter_dict(dictionary, keys):
"""Filter a dictionary by any keys not given.
Args:
dictionary (dict): Dictionary.
keys (iterable): Iterable containing data type(s) for valid dict key.
Return:
dict: Filtered dictionary.
"""
return {key:... | joeflack4/jflack | joeutils/data_structures/comprehensions/maps/__init__.py | Python | mit | 883 |
# Copyright 2021 The TensorFlow Ranking Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | tensorflow/ranking | tensorflow_ranking/examples/keras/tfrbert_task_experiments.py | Python | apache-2.0 | 2,440 |
import urllib, urllib2, cookielib,urlparse
import os, random, re
from contextlib import closing
from BeautifulSoup import BeautifulSoup
import json
BASE_PATH = 'http://www.italiansubs.net/index.php'
class Itasa(object):
"""
rss: http://www.italiansubs.net/index.php?option=com_rsssub... #myitasa or itasa sub... | carlo-colombo/ItasaFlexget | ItasaFlexGet.py | Python | mit | 5,083 |
# Example: monitors events and logs them into a log file.
#
import pyinotify
class Log(pyinotify.ProcessEvent):
def my_init(self, fileobj):
"""
Method automatically called from ProcessEvent.__init__(). Additional
keyworded arguments passed to ProcessEvent.__init__() are then
delegat... | seb-m/pyinotify | python2/examples/chain.py | Python | mit | 1,216 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'dumma_af.views.home', name='home'),
# url(r'^dumma_af/', include('dumma_af.foo.urls')),
ur... | Spindel/dumma_af | dumma_af/urls.py | Python | gpl-3.0 | 667 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from core.models import List, Item, Comment
from favit.models import Favorite
class ListAdmin(admin.ModelAdmin):
list_display = ["ListName","slug","ListOwner","ListOwnerState", "ListPubDate"]
search_fields = ("ListName","slug","ListOwner")
class Ite... | soplerproject/sopler | core/admin.py | Python | agpl-3.0 | 1,431 |
"""Unit tests for the bytes and bytearray types.
XXX This is a mess. Common tests should be moved to buffer_tests.py,
which itself ought to be unified with string_tests.py (and the latter
should be modernized).
"""
import os
import re
import sys
import copy
import operator
import pickle
import tempfile
import unitte... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/test/test_bytes.py | Python | mit | 41,679 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2015-Today Litex Service Sp. z o.o.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affer... | mwegrzynek/product_manual_variants | tests/__init__.py | Python | agpl-3.0 | 1,007 |
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required
from .views import *
urlpatterns = [
# Listado
url(r'^evaluacion-lista/', login_required(evaluacion_list), name='listar_evaluacion'),
# Evaluacion paso a paso
url(r'^generar/step1/$', login_required(evaluacion_ste... | Mansilla1/Sistema-SEC | apps/evaluacion/urls.py | Python | apache-2.0 | 2,293 |
import requests
url = "http://186.249.34.34/api/consulta"
payload = "{\n \"codigoProduto\": \"11\",\n \"tipoConsumidor\": \"F\",\n \"documentoConsumidor\": \"42924057191\",\n \"telefoneConsultar\": {\n \"ddd\": \"16\",\n \"numero\": \"999999999\"\n },\n \"cepConsumidor\": \"14401-360\",\n \... | enterplug/consulta-enterplug | consulta-11/consulta-11-python-example/consulta-11-python-requests.py | Python | mit | 792 |
# --------------------------------------------------------
# Fully Convolutional Instance-aware Semantic Segmentation
# Copyright (c) 2017 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Modified by Haozhi Qi
# --------------------------------------------------------
# Based on:
# MX-RCNN
# Copyr... | msracver/FCIS | fcis/core/DataParallelExecutorGroup.py | Python | mit | 27,490 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | kostin88/cm_api | python/src/cm_api_tests/test_services.py | Python | apache-2.0 | 1,965 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | ywcui1990/nupic | tests/unit/nupic/algorithms/backtracking_tm_constant_test.py | Python | agpl-3.0 | 5,242 |
# importing libraries:
from maya import cmds
from . import dpBaseControlClass
from importlib import reload
reload(dpBaseControlClass)
# global variables to this module:
CLASS_NAME = "LocatorFlat"
TITLE = "m133_locatorFlat"
DESCRIPTION = "m099_cvControlDesc"
ICON = "/Icons/dp_locatorFlat.png"
dpLocatorFlatVersion ... | nilouco/dpAutoRigSystem | dpAutoRigSystem/Controls/dpLocatorFlat.py | Python | gpl-2.0 | 2,457 |
#!/usr/bin/env python
import os
from tempfile import NamedTemporaryFile
from snakemake.shell import shell
# All wrappers must be able to handle an optional params.extra.
extra = snakemake.params.get('extra', '')
# This lets us handle whether to write to a log file or to write to stdout.
# See snakemake.script.log_fm... | lcdb/lcdb-wrapper-tests | wrappers/rseqc/infer_experiment/wrapper.py | Python | mit | 1,096 |
"""IDLE Configuration Dialog: support user customization of IDLE by GUI
Customize font faces, sizes, and colorization attributes. Set indentation
defaults. Customize keybindings. Colorization and keybindings can be
saved as user defined sets. Select startup options including shell/editor
and default window size. ... | PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/idlelib/configDialog.py | Python | gpl-2.0 | 52,843 |
# Copyright (C) 2010-2012 Red Hat, Inc.
# This work is licensed under the GNU GPLv2 or later.
# To test "virsh hostname" command
from libvirttestapi.utils import process
required_params = ()
optional_params = {}
VIRSH_HOSTNAME = "virsh hostname"
def hostname(params):
"""check virsh hostname command
"""
... | libvirt/libvirt-test-API | libvirttestapi/repos/domain/hostname.py | Python | gpl-2.0 | 1,070 |
# import_export_batches/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
import codecs
import csv
from datetime import date, timedelta
from django.db import models
from django.db.models import Q
from django.utils.http import urlquote
from django.utils.timezone import localtime, now
from election... | wevote/WeVoteServer | import_export_batches/models.py | Python | mit | 356,213 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/labs/consistent_zero_shot_nmt/utils/common_utils.py | Python | apache-2.0 | 1,241 |
#
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | vritant/subscription-manager | src/subscription_manager/dbus_interface.py | Python | gpl-2.0 | 2,989 |
import time
import json
import geojson
import copy
from geojson import Feature, Point, Polygon, MultiPolygon, GeometryCollection, FeatureCollection
from geojson import MultiPoint, MultiLineString, LineString
from collections import OrderedDict
from django.conf import settings
from django.db import models
from django.db... | ekansa/open-context-py | opencontext_py/apps/ocitems/ocitem/spatialtemporal.py | Python | gpl-3.0 | 24,192 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/global_/lsp_bit/overload_bit/__init__.py | Python | apache-2.0 | 25,678 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.