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 |
|---|---|---|---|---|---|
'''
@author: frank
'''
import sys, os, os.path
import fusionstoragent
from zstacklib.utils import log
from zstacklib.utils import linux
import zstacklib.utils.iptables as iptables
pidfile = '/var/run/zstack/fusionstor-primarystorage.pid'
log.configure_log('/var/log/zstack/fusionstor-primarystorage.log')
logger = log.... | live4thee/zstack-utility | fusionstorprimarystorage/fusionstorprimarystorage/cdaemon.py | Python | apache-2.0 | 1,568 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, ... | pytorch/fairseq | fairseq/criterions/sentence_ranking.py | Python | mit | 4,614 |
import os
import sys
import unittest
from osrf_pycommon.process_utils import execute_process_nopty
this_dir = os.path.dirname(os.path.abspath(__file__))
test_script = os.path.join(
this_dir,
'fixtures',
'execute_process',
'stdout_stderr_ordering.py')
python = sys.executable
file_nl = b"""
"""
nl = o... | osrf/osrf_pycommon | tests/unit/test_process_utils/test_execute_process_nopty.py | Python | apache-2.0 | 4,245 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-07 10:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('talks', '0006_author_helptext'),
]
operations = [
migrations.AlterModelOptions(
... | CTPUG/wafer | wafer/talks/migrations/0007_add_ordering_option.py | Python | isc | 404 |
from inbox.models.account import Account
from inbox.models.event import Event
from inbox.models.session import session_scope
from inbox.events.actions.backends import module_registry
from inbox.events.ical import (generate_icalendar_invite, send_invite)
def create_event(account_id, event_id, extra_args):
with ses... | jobscore/sync-engine | inbox/events/actions/base.py | Python | agpl-3.0 | 4,196 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | probcomp/cgpm | src/uncorrelated/linear.py | Python | apache-2.0 | 1,827 |
import json
f = open('test.json', 'r')
pathhook = json.load(f)
for key in pathhook:
print(key + ":" + pathhook[key]) | zhuango/python | pythonLearning/json/jsonload.py | Python | gpl-2.0 | 122 |
import json
try:
from urllib2 import Request, urlopen # Python 2
from urllib import urlretrieve
except:
from urllib.request import Request, urlopen, urlretrieve # Python 3
url = 'http://localhost:8080/'
content = urlopen(url).read()
print(content)
data = json.load(urlopen('http://localhost:8080/json'))
print(dat... | gdsglgf/toolkit | template/SpringBootApp/python/test.py | Python | mit | 322 |
#!/usr/bin/env python
#Creates an ad bucket with a seed term/domain
from pymongo import MongoClient
from similarity import find_by_html, find_by_similarsites, create_connection, tokenize_clean
from tabulate import tabulate
verbose = False
def get_rank(c, domain):
"""Gets the alexa rank for a domain. Returns False i... | tspurway/bucketer3r | interface/seed.py | Python | mpl-2.0 | 3,209 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0029_auto_20150823_2141'),
]
operations = [
migrations.CreateModel(
name='BrewPi',
fields=[
... | thomast74/oinkbrew_webapp | api/migrations/0030_auto_20150923_2344.py | Python | gpl-3.0 | 4,226 |
# Copyright (C) 2011-2013 2ndQuadrant Italia (Devise.IT S.r.L.)
#
# This file is part of Barman.
#
# Barman 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... | danimaribeiro/pg_barman_fork | barman/server.py | Python | gpl-3.0 | 25,056 |
from behaviours.Collide import Collide
from behaviours.Fall import Fall
from behaviours.Jump import Jump
from behaviours.Move import Move
from entities.base.Entity import Entity
from src.GameMethods import GameMethods
class Character(Entity):
def __init__(self, x, y, name):
Entity.__init__(self, x, y, nam... | cthit/CodeIT | entities/character/Character.py | Python | mit | 493 |
from django.test import TestCase
from .models import FunContent
class TestFunContent(TestCase):
def setUp(self):
self.quote = FunContent.objects.create(
message_type='quote',
message="Here's a quote",
author="Brad",
keywords=['foo', 'bar'],
)
d... | tndatacommons/tndata_backend | tndata_backend/rewards/tests.py | Python | mit | 1,876 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals, absolute_import
import json
import pytest
import requests
import requests.exception... | projectatomic/atomic-reactor | tests/conftest.py | Python | bsd-3-clause | 2,306 |
# The following exec statement (or something like it) is needed to
# prevent SyntaxError on Python < 2.5. Even though this is a test,
# SyntaxErrors are not acceptable; on Debian systems, they block
# byte-compilation during install and thus cause the package to fail
# to install.
import sys
if sys.version_info[:2] >=... | dwf/numpy | numpy/core/tests/test_errstate.py | Python | bsd-3-clause | 1,786 |
def digital_sum(nums_list):
""" (list of str) -> int
Precondition: s.isdigit() holds for each string s in nums_list.
Return the sum of all the digits in all strings in nums_list.
>>> digital_sum(['64', '128', '256'])
34
>>> digital_sum(['12', '3'])
6
"""
#total = 0
#f... | mdnu/snake | csc work/misc/w6/r/nested_lists_and_loops.py | Python | mit | 1,259 |
__copyright__ = """
Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.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 that it will be ... | miracle2k/stgit | stgit/commands/imprt.py | Python | gpl-2.0 | 11,466 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#%# family=auto
#%# capabilities=autoconf
import base64
import json
import os
from munin import MuninPlugin
import urllib2
class IcincaHealth(MuninPlugin):
title = "Icinga health"
args = '-l 0'
@property
def fields(self):
return [
("service_health", {
'lab... | ercpe/munin-plugins | plugins/icinga_health.py | Python | gpl-2.0 | 1,254 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
MapzenIsochrones
A QGIS plugin
This plugin generates travel-time isochrones via the Mapzen Isochrone service API
-------------------
begin ... | spatialmonk/qgsMapzenIsochrones | mapzen_isochrones.py | Python | mit | 8,254 |
import math
import numpy as np
import pytest
import ray
from ray import tune
from ray.tune.stopper import ExperimentPlateauStopper
from ray.tune.suggest import ConcurrencyLimiter
import unittest
def loss(config, reporter):
x = config.get("x")
reporter(loss=x**2) # A simple function to optimize
class Conve... | pcmoritz/ray-1 | python/ray/tune/tests/test_convergence.py | Python | apache-2.0 | 5,467 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | asajeffrey/servo | tests/wpt/web-platform-tests/webdriver/tests/perform_actions/support/keys.py | Python | mpl-2.0 | 25,178 |
# Generated by Django 2.1.11 on 2020-02-13 08:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tracking', '0004_auto_20200102_0914'),
]
operations = [
migrations.AddField(
model_name='device',
name='hidden',
... | ropable/resource_tracking | tracking/migrations/0005_device_hidden.py | Python | bsd-3-clause | 424 |
from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
def has_object_permissions(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always all... | dfurtado/generator-djangospa | generators/app/templates/root/main/permissions.py | Python | mit | 438 |
from django import forms
from olympia.lib.happyforms import Form
class MyTestForm(Form):
foo = forms.CharField()
def test_happyform_with_whitespace():
form = MyTestForm(data={'foo': ' blah '})
assert form.is_valid()
assert form.clean() == {'foo': 'blah'}
def test_happyform_with_newlines():
fo... | harikishen/addons-server | src/olympia/lib/tests/test_happyforms.py | Python | bsd-3-clause | 442 |
from flask import render_template, request
from uchan import app
from uchan.lib.exceptions import BadRequestError, ArgumentError
from uchan.lib.service import verification_service
from uchan.view import check_csrf_referer
# Do NOT cache this GET endpoint, an exception in the varnish config has been made.
@app.route(... | Floens/uchan | uchan/view/verify.py | Python | mit | 1,160 |
# -*- coding: utf-8 -*-
from django.db import models
from apps.registro.models.Anexo import Anexo
from apps.seguridad.audit import audit
@audit
class AnexoMatricula(models.Model):
anexo = models.ForeignKey(Anexo)
anio = models.IntegerField()
mixto = models.BooleanField()
profesorados = models.Positive... | MERegistro/meregistro | meregistro/apps/registro/models/AnexoMatricula.py | Python | bsd-3-clause | 1,657 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Juniper/nova | nova/tests/functional/api_sample_tests/test_hypervisors.py | Python | apache-2.0 | 12,739 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 OpenStack Foundation.
# 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.... | wallnerryan/quantum_migrate | quantum/extensions/agentscheduler.py | Python | apache-2.0 | 8,254 |
import subprocess as sp
#Target number of flops per run
total_flops = 5E9
output = []
for kernal in ['blas']:
#for kernal in ['plain','block16','blas']:
print '\nStarting %s kernal:' % kernal
for k in range(4, 15, 2):
k = 2**k
iter_total_flops = int(total_flops/k**3)
#If it is too... | dgasmith/SICM2-Software-Summer-School-2014 | Computer_Architechture/Original_Files/loop_gemm.py | Python | mit | 637 |
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
description: Optional[str] = None
price: float
tax: Optional[float] = None
app = FastAPI()
@app.put("/items/{item_id}")
async def create_item(item_id: int, item: Item):
retu... | tiangolo/fastapi | docs_src/body/tutorial003.py | Python | mit | 359 |
import unittest
from bulletphysics import *
class VehicleTest(unittest.TestCase):
def setUp(self):
collisionConfiguration = DefaultCollisionConfiguration()
self.world = DiscreteDynamicsWorld( CollisionDispatcher(collisionConfiguration),
DbvtBroadphase(), SequentialImpulseConstraintSolv... | 20tab/pybulletphysics | tests/test_vehicle.py | Python | mit | 1,450 |
# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
import glob
import logging
import os.path
import pytest
import numpy as np
from metpy.io.nexrad import Level2File, Level3File, is_precip_mode
from metpy.cbook import get_tes... | deeplycloudy/MetPy | metpy/io/tests/test_nexrad.py | Python | bsd-3-clause | 3,690 |
"""
Deployment file to facilitate releases of pymatgen.
Note that this file is meant to be run from the root directory of the pymatgen
repo.
"""
__author__ = "Shyue Ping Ong"
__email__ = "ongsp@ucsd.edu"
__date__ = "Sep 1, 2014"
import glob
import os
import json
import webbrowser
import requests
import re
import subp... | Dioptas/pymatgen | fabfile.py | Python | mit | 4,612 |
import re
import logging
import datetime
import json
from json.encoder import JSONEncoder
from xmodule.modulestore import Location
from xmodule.modulestore.exceptions import ItemNotFoundError
from contentstore.utils import get_modulestore, course_image_url
from models.settings import course_grading
from xmodule.fields... | nanolearning/edx-platform | cms/djangoapps/models/settings/course_details.py | Python | agpl-3.0 | 8,296 |
#!/usr/bin/python
import redis
import argparse
import random
import string
import sys
import time
from utils import string_generator, number_generator
from dyno_node import DynoNode
from redis_node import RedisNode
from dyno_cluster import DynoCluster
from dual_run import dual_run, ResultMismatchError
def parse_args(... | jbfavre/dynomite | test/func_test.py | Python | apache-2.0 | 5,406 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import threading
import asyncio
@asyncio.coroutine
def hello():
print('Hello world! (%s)' % threading.currentThread())
yield from asyncio.sleep(1)
print('Hello again! (%s)' % threading.currentThread())
loop = asyncio.get_event_loop()
tasks = [hello(), hello(... | dabin521/learn-python3 | samples/async/async_hello.py | Python | gpl-2.0 | 381 |
"""
Copyright (c) 2015-2016 Cisco Systems, Inc. and others. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
"""
fro... | omerpalaz/openbmp-python-api-message | src/openbmp/api/parsed/message/Base.py | Python | epl-1.0 | 3,050 |
# -*- coding: utf-8 -*-
import os
import logging
import shlex
import re
import subprocess
import tornado
import hashlib
import random
from tornado.options import define, options
from tornado.web import URLSpec
class _NoDefault:
"""No default value rather than confused None"""
def __repr__(self):
retu... | feilaoda/FlickBoard | project/lib/utils.py | Python | mit | 4,599 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | BorgERP/borg-erp-6of3 | server/openerp/report/render/makohtml2html/__init__.py | Python | agpl-3.0 | 1,120 |
# Copyright 2020 The TensorFlow Probability 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 require... | tensorflow/probability | tensorflow_probability/python/stats/kendalls_tau_test.py | Python | apache-2.0 | 3,547 |
from django.contrib.admin import site as admin_site
from .models import Platform
admin_site.register(Platform)
| respawner/peering-manager | devices/admin.py | Python | apache-2.0 | 113 |
from datetime import datetime
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy import testing
from sqlalchemy.testing import fixtures
from sqlalchemy.testing.schema import Table, Column
class InheritTest(fixtures.MappedTest):
"""tests some various inheritance round trips involving a particula... | rclmenezes/sqlalchemy | test/orm/inheritance/test_productspec.py | Python | mit | 12,777 |
#!/usr/bin/python
# Must be run under sudo
# Requires: sudo pip install rpi_ws281x
import _rpi_ws281x as ws
from time import sleep, time
from math import modf
import colorsys
# LED configuration.
LED_COUNT = 27 # How many LEDs to light.
# 0..2
LED_CHANNEL = 0
# Frequency of the LED signal. Sh... | n0bel/PiClock | Leds/NeoAmbi.py | Python | mit | 2,591 |
from .. import util
import colorsys
def hsv2rgb_raw(hsv):
"""
Converts an HSV tuple to RGB. Intended for internal use.
You should use hsv2rgb_spectrum or hsv2rgb_rainbow instead.
"""
HSV_SECTION_3 = 0x40
h, s, v = hsv
# The brightness floor is minimum number that all of
# R, G, and ... | rec/BiblioPixel | bibliopixel/colors/conversions.py | Python | mit | 6,713 |
from graphql.type.definition import (
GraphQLArgument,
GraphQLField,
GraphQLNonNull,
GraphQLObjectType,
)
from graphql.type.scalars import GraphQLString
from graphql.type.schema import GraphQLSchema
def resolve_raises(*_):
raise Exception("Throws!")
QueryRootType = GraphQLObjectType(
name="Q... | graphql-python/graphql-server-core | tests/quart/schema.py | Python | mit | 1,514 |
from nose.plugins.attrib import attr
from nose.tools import eq_, ok_
from django.contrib import messages as django_messages
from django.test import RequestFactory
from allauth.exceptions import ImmediateHttpResponse
from allauth.socialaccount.models import SocialLogin, SocialAccount
from kuma.core.urlresolvers impor... | openjck/kuma | kuma/users/tests/test_adapters.py | Python | mpl-2.0 | 4,720 |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Anthony Verez averez@mozilla.com
# Je... | ameihm0912/MozDef | cron/backupSnapshot.py | Python | mpl-2.0 | 6,769 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | belokop/indico_bare | indico/modules/events/registration/placeholders/registrations.py | Python | gpl-3.0 | 3,962 |
# Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... | dsweet04/rekall | rekall-core/rekall/plugins/windows/cache.py | Python | gpl-2.0 | 14,977 |
# -*- extra stuff goes here -*-
from simmap import ISimMap
from settings import ISimMapSettings
from addon import ISimMapInstalled
| LEAMgroup/leam.simmap | leam/simmap/interfaces/__init__.py | Python | gpl-2.0 | 131 |
# coding: utf-8
# Author: Roman Miroshnychenko aka Roman V.M.
# E-mail: romanvm@yandex.ua
"""
This package contains common content used by all applications
"""
__all__ = ['default_app_config']
default_app_config = 'common_content.apps.CommonContentAppConfig'
| romanvm/romans_blog | common_content/__init__.py | Python | gpl-3.0 | 261 |
from __future__ import unicode_literals
from datetime import date
from django.contrib.auth import (
BACKEND_SESSION_KEY, SESSION_KEY, authenticate, get_user,
)
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.hashers import MD5PasswordHasher
from django.contrib.auth.models import Ano... | mcella/django | tests/auth_tests/test_auth_backends.py | Python | bsd-3-clause | 23,583 |
from api import actions
from django.contrib.auth import get_user_model
from api.tests import APITestCase
import json
from .util import load_content_as_json
class IntegrationTestCase(APITestCase):
content_data = []
structure_data = {
"constraints": [
{
"constraint_type": "PR... | tom-heimbrodt/oeplatform | api/tests/test_integration.py | Python | agpl-3.0 | 5,655 |
import multiprocessing
from .commands import MachopCommand
from .mplog import MachopLog
class MachopAsyncCommand(MachopCommand, multiprocessing.Process):
def __init__(self, command, path, queue):
self.command = command
self.queue = queue
self.path = path
super(MachopAsyncCommand... | phlip9/machop | machop/async.py | Python | bsd-2-clause | 637 |
"""
Class for normalizing fission energy deposition
"""
from copy import deepcopy
from itertools import product
from numbers import Real
import bisect
from collections import defaultdict
from numpy import dot, zeros, newaxis
from . import comm
from openmc.checkvalue import check_type, check_greater_than
from openmc.l... | smharper/openmc | openmc/deplete/helpers.py | Python | mit | 25,406 |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
import test.support
from test.support import captured_stderr, TESTFN, EnvironmentVarGuard
import builtins
import os
import sys
import re
import encodings
import urllib.re... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.6.0/Lib/test/test_site.py | Python | mit | 19,555 |
# -*- coding: utf-8 -*-
# © 2015-2015 Yannick Vaucher, Leonardo Pistone, Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class TestIntSaleToReservation(TransactionCase):
"""Integration tests of the propagation of the owner.
Her... | kittiu/sale-workflow | sale_owner_stock_sourcing/tests/test_int_sale_to_reservation.py | Python | agpl-3.0 | 3,047 |
# -*- coding: utf-8 -*-
from flask import Flask
from flask.ext.cors import CORS
from soya.apps import api
from soya.settings import (
DEBUG,
SECRET_KEY,
)
def init_others(app):
pass
def init_config(app):
app.config.update({
"PERMANENT_SESSION_LIFETIME": 60*15,
"SESSION_REFRESH_EACH... | streethacker/soya | soya/server.py | Python | gpl-2.0 | 711 |
# Author: Sebastien Erard <sebastien_erard@hotmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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... | srluge/SickRage | sickbeard/notifiers/synoindex.py | Python | gpl-3.0 | 3,355 |
# Copyright 2012 Nebula, 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 agree... | mrunge/horizon_lib | horizon_lib/utils/validators.py | Python | apache-2.0 | 1,727 |
# -*- coding: utf-8 -*-
'''Custom exceptions for the framework.'''
import copy
import httplib as http
from flask import request
from website import language
class FrameworkError(Exception):
"""Base class from which framework-related errors inherit."""
pass
class HTTPError(FrameworkError):
error_msgs = {... | icereval/osf.io | framework/exceptions/__init__.py | Python | apache-2.0 | 3,868 |
import networkx as nx
import csv
import pylab as plt
### LOAD NETWORK FROM FILE ###
nyc_net = nx.read_edgelist(
'newyork_net.txt', create_using=nx.DiGraph(), nodetype=int)
### READ FOURSQUARE VENUES DATA ###
node_data = {}
with open('venue_data_4sq_newyork_anon.csv') as csvfile:
reader = csv.DictReader(csvfi... | bmtgoncalves/Mining-Georeferenced-Data | PlaceNetworks_Live/network_analysis.py | Python | bsd-3-clause | 4,016 |
import alpenglow.Getter as rs
import alpenglow as prs
class FactorExperiment(prs.OnlineExperiment):
"""FactorExperiment(dimension=10,begin_min=-0.01,begin_max=0.01,learning_rate=0.05,regularization_rate=0.0,negative_rate=100)
This class implements an online version of the well-known matrix factorization reco... | rpalovics/Alpenglow | python/alpenglow/experiments/FactorExperiment.py | Python | apache-2.0 | 2,713 |
import base64
import math
import re
from datetime import datetime, timedelta
from ipaddress import ip_address
import flask
from flask_paginate import Pagination
from nyaa import models
from nyaa.extensions import db
from nyaa.search import (DEFAULT_MAX_SEARCH_RESULT, DEFAULT_PER_PAGE, SERACH_PAGINATE_DISPLAY_MSG,
... | nyaadevs/nyaa | nyaa/views/main.py | Python | gpl-3.0 | 8,844 |
import os
from setuptools import setup
setup(
name='qcms',
version='0.1',
packages=['qcms'],
include_package_data=True,
install_requires=[
'django',
'django_ckeditor',
'Pillow',
],
)
| gzqichang/wa | qcms/setup.py | Python | mit | 233 |
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'celcius.settings')
app = Celery('celsius')
# Using a string here means the worker doesn't have to serialize
... | cytex124/celsius-cloud-backend | src/celsius/celery.py | Python | mit | 623 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mgxrace.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| MGXRace/website | manage.py | Python | gpl-2.0 | 250 |
from wtforms import StringField, TextAreaField, IntegerField, validators as v
from flask_wtf import Form as FlaskForm
from flask_wtf.file import FileField, FileAllowed
class BuddyCreation(FlaskForm):
name = StringField(
'Name', [
v.Length(min=1, max=63),
v.DataRequired()
])... | asiderop/buddly | buddly/forms.py | Python | mit | 1,719 |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'validators',
'request... | jkubaile/pixget | setup.py | Python | mit | 998 |
import time
millis = time.time()
keyboard = Runtime.createAndStart("keyboard", "Keyboard")
keyboard.addListener("keyCommand", python.getName(), "input")
leftPort = "COM3"
rightPort = "COM7"
i01 = Runtime.createAndStart("i01", "InMoov")
# starts everything
i01.startAll(leftPort, rightPort)
torso = i01.start... | sstocker46/pyrobotlab | home/Markus/importTimeMillis.py | Python | apache-2.0 | 3,568 |
from __future__ import unicode_literals
from .atomicparsley import AtomicParsleyPP
from .ffmpeg import (
FFmpegPostProcessor,
FFmpegAudioFixPP,
FFmpegEmbedSubtitlePP,
FFmpegExtractAudioPP,
FFmpegFixupStretchedPP,
FFmpegMergerPP,
FFmpegMetadataPP,
FFmpegVideoConvertorPP,
)
from .xattrpp ... | janusnic/youtube-dl-GUI | youtube_dl/postprocessor/__init__.py | Python | mit | 760 |
# Copyright 2011 the Melange 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 agreed to in wr... | rhyolight/nupic.son | app/summerofcode/views/shipment_tracking.py | Python | apache-2.0 | 13,707 |
#!/usr/bin/env python3
# Sifer Aseph
"""Prints a "hello world" statement."""
def main():
"""Utterly standard."""
print("Hello cruel world.")
if __name__ == "__main__":
main()
| Surufel/Personal | 2.pysifer/Older/hello_world.py | Python | agpl-3.0 | 189 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.6.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x06\x92\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x64\x0... | President3D/Quality-SPC | src/InResources_rc.py | Python | gpl-3.0 | 124,824 |
from __future__ import print_function, absolute_import
from numba import roc
from numba.npyufunc import deviceufunc
from numba.roc import dispatch
vectorizer_stager_source = '''
def __vectorized_{name}({args}, __out__):
__tid__ = __hsa__.get_local_id(0)
__blksz__ = __hsa__.get_local_size(0)
__blkid__ = ... | jriehl/numba | numba/roc/vectorizers.py | Python | bsd-2-clause | 4,363 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import pkg_resources
# Get the project root dir, which is the parent dir of this
cwd = os.getcwd()
project_root = os.path.dirname(cwd)
# Insert the project root dir as the first element in the PYTHONPATH.
# This lets us ensure that the source packag... | ecmwf/cfgrib | docs/conf.py | Python | apache-2.0 | 5,408 |
from motifsim_gillespie_cell import Cell
from motifsim_gillespie_population import Population
import random as rand
from copy import deepcopy
from copy import copy
import math
def motifsim_trial(motif,max_strand_nr,maxStrandLength,numCells,numRounds,elong,bias):
population = Population([],'empty','empty','empty')
... | grantkinsler/motifproject | motifsim_gillespie/motifsim_gillespie_trial.py | Python | mit | 1,887 |
# -*- coding: utf-8 -*-
# pylint: disable=C0111
# pylint: disable=import-error,3rd-party-module-not-gated,redefined-builtin
from __future__ import absolute_import
def show_low_sls(*states):
result = {}
for state in states:
if isinstance(state, dict):
for key, states2 in state.items():
... | AvengerMoJo/DeepSea | srv/salt/_modules/deepsea.py | Python | gpl-3.0 | 2,590 |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView
from lib.tools.mixin import LoginRequiredMixin
class LibraryImageView(LoginRequiredMixin, TemplateView):
template_name = 'library/image/index.html'
| doraemonext/wechat-platform | wechat_platform/admin/library/image/views.py | Python | bsd-2-clause | 271 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | dietrichc/streamline-ppc-reports | examples/adwords/v201406/basic_operations/add_keywords.py | Python | apache-2.0 | 2,784 |
'''
Module for discovering services over SSDP (Simple Service Discovery Protocol)
Example usage:
from bulby import ssdp
ssdp.discover("IpBridge")
'''
import socket
import http
from io import BytesIO
class SSDPResponse(object):
class _FakeSocket(BytesIO):
def makefile(self, *args, **kw):
retur... | sontek/bulby | bulby/ssdp.py | Python | mit | 1,816 |
"""Pseudo terminal utilities."""
# Bugs: No signal handling. Doesn't set slave termios and window size.
# Only tested on Linux.
# See: W. Richard Stevens. 1992. Advanced Programming in the
# UNIX Environment. Chapter 19.
# Author: Steen Lumholt -- with additions by Guido.
from select import select
imp... | trivoldus28/pulsarch-verilog | tools/local/bas-release/bas,3.9/lib/python/lib/python2.3/pty.py | Python | gpl-2.0 | 5,177 |
import sys
sys.path.append("../projects/tools")
import msh
import os
import numpy as np
from scipy.spatial.distance import cdist
def nearest_neighbor(src, dst):
all_dists = cdist(src, dst, 'euclidean')
indices = all_dists.argmin(axis=1)
distances = all_dists[np.arange(all_dists.shape[0]), indices]
retu... | ISCDtoolbox/FaciLe | pipeline/scaleSol.py | Python | gpl-3.0 | 1,647 |
"""
author: Connor Goldberg
project: High Altitude Balloon Instrumentation Platform
description: Soundmodem beacon functionality
"""
import subprocess
import logger
class beacon(object):
"""
Send data over the soundmodem beacon interface
"""
MAX_PACKET_LEN = 255
def __init__(self, interface, source, destinatio... | TightSquad/HABIP | pi/comms/beacon.py | Python | gpl-3.0 | 929 |
"""
API Blueprint
"""
from flask import Blueprint
api = Blueprint('api', __name__)
from . import views
| northwest-knowledge-network/mdedit | app/api/__init__.py | Python | bsd-3-clause | 105 |
from _baseclass import ArtBaseClass
from opc.hue import hsvToRgb
from random import random, randrange
class Rectangle(object):
def __init__(self, matrix):
self.value = 0.0
self.hue = random()
self.x = randrange(0, matrix.width)
self.y = randrange(0, matrix.height)
self.... | slobberchops/rop | art/block.py | Python | gpl-3.0 | 1,071 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2007 Troy Melhase <troy@gci.net>
# Distributed under the terms of the GNU General Public License v2
from PyQt4.QtCore import QVariant, Qt, pyqtSignature
from PyQt4.QtGui import QItemDelegate, QStandardItem, QStandardItemModel
from PyQt4.QtGui import QApplicati... | anuragamodi/profitpy | examples/accountsummary.py | Python | gpl-2.0 | 8,697 |
import sys
import os
if os.path.isfile("/usr/lib/enigma2/python/enigma.zip"):
sys.path.append("/usr/lib/enigma2/python/enigma.zip")
from Tools.Profile import profile, profile_final
profile("PYTHON_START")
# Don't remove this line. It may seem to do nothing, but if removed,
# it will break output redirection for cras... | openmips/stbgui | mytest.py | Python | gpl-2.0 | 20,429 |
#!/usr/bin/python
#
# Copyright (c) 2017 Yuwei Zhou, <yuwzho@microsoft.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alxgu/ansible | lib/ansible/modules/cloud/azure/azure_rm_image.py | Python | gpl-3.0 | 14,438 |
from .pypvwatts import PVWatts
from .pvwattserror import PVWattsValidationError
| mpaolino/pypvwatts | pypvwatts/__init__.py | Python | mit | 80 |
# -*- coding: utf-8 -*-
#
# SelfTest/Cipher/ARC4.py: Self-test for the Alleged-RC4 cipher
#
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedicat... | hclivess/Stallion | nuitka/Cryptodome/SelfTest/Cipher/test_ARC4.py | Python | gpl-3.0 | 24,744 |
import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
if cuda.cudnn_enabled:
cudnn = cuda.cudnn
libcudnn = cudnn.cudnn
_mode = libcudnn.CUDNN_ACTIVATION_TANH
class Tanh(function.Function):
"""Hyperbolic tangent function."""
def __init__(self, u... | muupan/chainer | chainer/functions/activation/tanh.py | Python | mit | 2,562 |
# coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility an... | ballouche/navitia | source/jormungandr/jormungandr/autocomplete/abstract_autocomplete.py | Python | agpl-3.0 | 1,893 |
import logging
import sys
_logger = None
def get_logger():
global _logger
if _logger:
return _logger
formatter = logging.Formatter(fmt='%(levelname)s: %(message)s')
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(formatter)
_logger = logging.getLogger('aq')
_log... | lebinh/aq | aq/logger.py | Python | mit | 550 |
# -*- coding: utf-8 -*-
from GABase import Evaluator, Instance, PopulationGenerator
from random import random, randint, choice
from math import floor
from sys import exit
N_MUTATIONS = 2 # Maximum number of possible mutations in generation
P_MUTATION = 0.1
P_NOT_WORKING = 0.15
HARD_CONSTR_PENALTY = 2500 # Penalty f... | Tweety-FER/hmo-project | GAImpl.py | Python | mit | 16,771 |
# This code is mostly based on Matthieu Courbariaux's
# Binary Neural Network code, accessable from:
# https://github.com/MatthieuCourbariaux/BinaryNet
# Jintao has modify the code so it is able to implemented on-chip.
import time
import os
import sys
from collections import OrderedDict
import numpy as np
# specif... | jintao-zhang/OnchipBNN | Train-time/binary_net.py | Python | bsd-3-clause | 12,869 |
import pytest
from datetime import datetime, timedelta
import pytz
import numpy as np
from pandas import (NaT, Index, Timestamp, Timedelta, Period,
DatetimeIndex, PeriodIndex,
TimedeltaIndex, Series, isna)
from pandas.util import testing as tm
from pandas._libs.tslib import iNa... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/tests/scalar/test_nat.py | Python | apache-2.0 | 9,530 |
from __future__ import absolute_import
from .action_mapping import ActionMapping, ActionMappingEntry
from .action_node import ActionNode
from .action_pool import ActionPool
from .belief_node import BeliefNode
from .belief_structure import BeliefStructure
from .belief_tree import BeliefTree
from .historical_data import ... | pemami4911/POMDPy | pomdpy/pomdp/__init__.py | Python | mit | 890 |
import sys, os, numpy
from HapMixUtil import *
def get_commandline_options():
"""Get user options from command line"""
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-c", "--CN_distr_filename", dest="CN_distr_json", help="Distribution of copy numbers json file")... | Illumina/HapMix | bin/createTumorTruthFile.py | Python | gpl-3.0 | 4,310 |
# Copyright 2014-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
doc = """CVS plug-in module for portage.
Performs a cvs up on repositories."""
__doc__ = doc[:]
from portage.localization import _
from portage.sync.config_checks import CheckSyncConfig
from portage.util import ... | gmt/portage | pym/portage/sync/modules/cvs/__init__.py | Python | gpl-2.0 | 1,316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.