text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
def diff_int(d=0.01*u.cm,a=0.001*u.cm,wl=400*u.nm):
'''
function that returns the intensity of a double slit interference pattern
'''
theta = arange(-10,10,1e-5)*u.degree
x = pi*a*sin(theta)/wl*u.radian
xnew = x.decompose()
i_single = (sin(xnew)/xnew)**2
y = pi*d*sin(theta)/wl*u.ra... | kfollette/ASTR200-Spring2017 | Homework/diff_int.py | Python | mit | 441 | 0.022676 |
# Code for performing minimal parsing of libmagic-compatible signature files.
# This allows for building a single signature file from multiple other signature files,
# and for parsing out the initial magic signature bytes for each signature (used for
# pre-processing of data to limit the number of actual calls into lib... | 17twenty/binwalk | src/binwalk/core/parser.py | Python | mit | 13,154 | 0.004485 |
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | CyanogenMod/android_external_chromium-trace | trace-viewer/third_party/pywebsocket/src/mod_pywebsocket/util.py | Python | bsd-3-clause | 16,267 | 0.000184 |
# Claire Jaja
# 11/1/2014
#
# Project Euler
# Problem 2
# Even Fibonacci numbers
#
# Each new term in the Fibonacci sequence is generated by adding
# the previous two terms.
# By starting with 1 and 2, the first 10 terms will be:
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
# By considering the terms in the Fibonacci seque... | clairejaja/project-euler | src/main/python/problem2/even_fibonacci_numbers.py | Python | mit | 876 | 0.001142 |
"""Constants for AccuWeather integration."""
from __future__ import annotations
from typing import Final
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_EXCEPTIONAL,
ATTR_CONDITION_FOG,
ATTR_CONDITION_HAIL,
ATTR_CONDITION_LIGHTNI... | kennedyshead/home-assistant | homeassistant/components/accuweather/const.py | Python | apache-2.0 | 10,736 | 0 |
from setuptools import setup
import py2exe
import os
import glob
__import__('gtk')
__import__('jinja2')
__import__('docutils')
setup_dict = dict(
name='regenerate',
version='1.0.0',
license='License.txt',
author='Donald N. Allingham',
author_email='dallingham@gmail.com',
description='Re... | dallingham/regenerate | setup-win.py | Python | gpl-2.0 | 3,108 | 0.003861 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_fusion_seqpool_cvm_concat_op.py | Python | apache-2.0 | 4,299 | 0.000465 |
"""
SignalHound related detector functions
extracted from pycqed/measurement/detector_functions.py commit 0da380ad2adf2dc998f5effef362cdf264b87948
"""
import logging
import time
from packaging import version
import qcodes as qc
from pycqed.measurement.det_fncs.Base import Soft_Detector, Hard_Detector
from pycqed.me... | DiCarloLab-Delft/PycQED_py3 | pycqed/measurement/det_fncs/hard/SignalHound.py | Python | mit | 5,908 | 0.000508 |
import logging
class Error(Exception):
def __init__(self, message, data = {}):
self.message = message
self.data = data
def __str__(self):
return self.message + ": " + repr(self.data)
@staticmethod
def die(code, error, message = None):
if isinstance(error, Exception):
... | hiqdev/reppy | heppy/Error.py | Python | bsd-3-clause | 580 | 0.010345 |
# -*- 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-aiplatform | google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py | Python | apache-2.0 | 34,518 | 0.001477 |
from ConfigParser import DEFAULTSECT
from cmd import Cmd
import logging
import sys
import subprocess
import argparse
import datetime
from fibbing import FibbingManager
import fibbingnode
from fibbingnode.misc.utils import dump_threads
import signal
log = fibbingnode.log
CFG = fibbingnode.CFG
class FibbingCLI(Cmd):
... | lferran/FibbingNode | fibbingnode/southbound/main.py | Python | gpl-2.0 | 7,223 | 0 |
from collections import deque
import time
import requests
# Constants
BRAZIL = 'br'
EUROPE_NORDIC_EAST = 'eune'
EUROPE_WEST = 'euw'
KOREA = 'kr'
LATIN_AMERICA_NORTH = 'lan'
LATIN_AMERICA_SOUTH = 'las'
NORTH_AMERICA = 'na'
OCEANIA = 'oce'
RUSSIA = 'ru'
TURKEY = 'tr'
# Platforms
platforms = {
BRAZIL: 'BR1',
EUR... | gnozell/Yar-Ha-Har | lib/riotwatcher/riotwatcher.py | Python | mit | 22,700 | 0.00163 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Test QiBuild Find """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ im... | aldebaran/qibuild | python/qibuild/test/test_qibuild_find.py | Python | bsd-3-clause | 3,244 | 0.000308 |
#!/usr/bin/python
import getpass
import snmp_helper
from snmp_helper import snmp_get_oid,snmp_extract
import yaml
DeviceIp1 = '184.105.247.70'
DeviceIp2 = '184.105.247.71'
SnmpPort = 161
sysNameOID = '.1.3.6.1.2.1.1.5.0'
sysDescOID = '.1.3.6.1.2.1.1.1.0'
#Connecting to the devices, using methods from getpass librar... | brutalic/pynet_brutal | class2/GetSysNameDesc.py | Python | apache-2.0 | 1,227 | 0.007335 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS (Oracle)
Date : Aug 27, 2014
copyright : (C) 2014 by Médéric RIBREUX
email : meder... | SebDieBln/QGIS | python/plugins/db_manager/db_plugins/oracle/plugin.py | Python | gpl-2.0 | 22,853 | 0.000131 |
import glob
import os
import shutil
from distutils import sysconfig
from setuptools import setup, Command
from setuptools.command.install import install
here=os.path.dirname(os.path.abspath(__file__))
site_packages_path = sysconfig.get_python_lib()
class CleanCommand(Command):
"""Custom clean command to tidy up ... | stuaxo/pyHotReload | setup.py | Python | bsd-2-clause | 2,321 | 0.004308 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.compliance_objects import ComplianceBuilding
log = logging.getLogger(__name__)
class TestComplianceBuilding(unittest.TestCase):
def setUp(self):
self.fd, self.path ... | rbuffat/pyidf | tests/test_compliancebuilding.py | Python | apache-2.0 | 1,041 | 0.003842 |
#!/usr/bin/env python3
"""
Open csv file with each a list. All the row-lists are contained in a list. In
preparation for entry into the database the data is cleaned. This includes
validating the headers and striping and lowering the values.
"""
import csv
HEADERS = ['case number', 'case occurred from date', 'case oc... | scott48074/Restorative-Justice-App | app/csv_handler.py | Python | mit | 1,556 | 0.003856 |
from django import forms
from registration.forms import RegistrationForm
from django.contrib.auth.models import User
from models import UserProfile
from models import *
class Registration(RegistrationForm):
picture = forms.ImageField(required=False)
bio = forms.CharField(widget=forms.Textarea(),required=False)... | RetroMelon/PatchWords | patchwords_project/patchwords/forms.py | Python | mit | 1,944 | 0.013374 |
# -*- coding: utf-8 -*-
#
# 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
#... | malmiron/incubator-airflow | tests/contrib/hooks/test_azure_data_lake_hook.py | Python | apache-2.0 | 5,649 | 0.00354 |
import json
import re
import requests
from_cmdline = False
try:
__file__
from_cmdline = True
except NameError:
pass
if not from_cmdline:
import vim
METHOD_REGEX = re.compile('^(GET|POST|DELETE|PUT|HEAD|OPTIONS|PATCH) (.*)$')
HEADER_REGEX = re.compile('^([^()<>@,;:\<>/\[\]?={}]+):\\s*(.*)$')
VAR_REGEX... | aquach/vim-http-client | plugin/http_client.py | Python | mit | 8,172 | 0.005996 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, merge, publish... | rwl/PyCIM | CIM14/ENTSOE/Dynamics/IEC61970/Dynamics/ExcitationSystems/ExcitationSystemsExcAC3A.py | Python | mit | 3,453 | 0.01448 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | philippjfr/bokeh | bokeh/colors/color.py | Python | bsd-3-clause | 5,085 | 0.00885 |
# -*- coding: utf-8 -*-
from .. import server, utils
class Memcached(server.Server):
binary = 'memcached'
def init(self, **kwargs):
self.binary = utils.find_binary(kwargs.get('memcached_bin', self.binary))
assert 'ip' in kwargs, "memcached servers requires <ip> option"
self.ip = kwa... | mialinx/testenv | testenv/contrib/memcached.py | Python | mit | 510 | 0.005882 |
""" The Watchdog Factory instantiates a given Watchdog based on a quick
determination of the local operating system.
"""
__RCSID__ = "$Id$"
import re
import platform
from DIRAC import S_OK, S_ERROR, gLogger
class WatchdogFactory( object ):
##################################################################... | andresailer/DIRAC | WorkloadManagementSystem/JobWrapper/WatchdogFactory.py | Python | gpl-3.0 | 2,478 | 0.033495 |
# -*- coding: utf-8 -*-
# © 2017 Didotech srl (www.didotech.com)
{
"name": "BoM Warning",
"version": "4.0.1.2",
"depends": [
"mrp",
"base",
"product",
"warning"
],
"author": "Didotech srl",
"description": """
This module is aim to track the warning on Bills o... | iw3hxn/LibrERP | mrp_bom_warning/__openerp__.py | Python | agpl-3.0 | 588 | 0.001704 |
#!/usr/bin/env python3
print("this is a test program to see if")
print("we can make a new file in github")
print("and push it to the hub.")
| nap-complex/pythonPractice | newFile.py | Python | gpl-3.0 | 143 | 0.006993 |
from distutils.core import setup
import os
from teams import get_version
# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
for dirpath, dirnames, filenames in os.wa... | cwilhelm/django-teams | setup.py | Python | bsd-3-clause | 1,758 | 0.001706 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | madjam/mxnet | python/mxnet/ndarray/sparse.py | Python | apache-2.0 | 50,947 | 0.003199 |
# vi: ts=4 expandtab
#
# Copyright (C) 2013 Canonical Ltd.
#
# Author: Ben Howard <ben.howard@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# Th... | prometheanfire/cloud-init | cloudinit/sources/DataSourceSmartOS.py | Python | gpl-3.0 | 29,325 | 0 |
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# 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) 2011-2015 Star2Billing S.L.
#
# The Initial Develope... | Star2Billing/cdr-stats | cdr_stats/apirest/view_user.py | Python | mpl-2.0 | 1,041 | 0.001921 |
import requests
import json
import yaml
import pandas as pd
import pprint
from jsonld_processor import jsonld2nquads, fetchvalue
from utils import int2str
class SmartAPIHandler:
def __init__(self):
# description info about endpoint, bioentity and api
self.endpoint_info = {}
self.bioentity_i... | kevinxin90/biothings_explorer_jupyter_notebook | api_handler.py | Python | apache-2.0 | 7,479 | 0.00361 |
import galaxy.model
from galaxy.model.orm import *
from base.twilltestcase import TwillTestCase
class TestMetadataEdit( TwillTestCase ):
def test_00_metadata_edit( self ):
"""test_metadata_edit: Testing metadata editing"""
self.logout()
self.login( email='test@bx.psu.edu' )
self.ne... | dbcls/dbcls-galaxy | test/functional/test_metadata_editing.py | Python | mit | 2,489 | 0.023303 |
import os
import subprocess
import pytest
import flask_resize
from .decorators import requires_redis, slow
@pytest.fixture
def env(tmpdir, redis_cache):
basedir = tmpdir
conffile = tmpdir.join('flask-resize-conf.py')
conffile.write(
"""
RESIZE_URL = 'https://example.com'
RESIZE_ROOT = '{root}'
... | jmagnusson/Flask-Resize | tests/test_bin.py | Python | bsd-2-clause | 2,759 | 0 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'therapy_session',
'transactions': [
{
'label': _('Assessments'),
'items': ['Patient Assessment']
}
]
}
| gsnbng/erpnext | erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py | Python | agpl-3.0 | 226 | 0.044248 |
#!/usr/bin/python
#
# Copyright 2012 Anthony Campbell (anthonycampbell.co.uk)
#
# 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 re... | acampbell3000/clojure-imdb-parser | run.py | Python | apache-2.0 | 4,140 | 0.003623 |
# JEB sample script
# http://www.android-decompiler.com/
#
# AlertMarker.py
# Set(unset) alert marker to focued method.
#
# Copyright (c) 2013 SecureBrain
from jeb.api import IScript
from jeb.api.dex import Dex
from jeb.api.ui import View
import string
class AlertMarker(IScript):
def run(self, jeb... | SecureBrain/JEB-sample-scripts | AlertMarker.py | Python | mit | 1,017 | 0.000983 |
from gevent import monkey
monkey.patch_all()
import pytest
import gevent
import marshmallow
from channelstream.server_state import get_state
from channelstream.channel import Channel
@pytest.mark.usefixtures("cleanup_globals", "pyramid_config")
class TestConnectViews(object):
def test_bad_json(self, dummy_reque... | AppEnlight/channelstream | tests/tests_views.py | Python | bsd-3-clause | 21,292 | 0.00108 |
import bs
import random
import bsUtils
#import PlayerSpaz
def bsGetAPIVersion():
# see bombsquadgame.com/apichanges
return 4
def bsGetGames():
return [BackToYou]
class Icon(bs.Actor):
def __init__(self,player,position,scale,showLives=True,showDeath=True,
nameScale=1.0,nameM... | Mrmaxmeier/BombSquad-Community-Mod-Manager | mods/BackToYou.py | Python | unlicense | 25,208 | 0.012734 |
from Crypto.Cipher import AES
import xml.etree.cElementTree as ET
import win32con, win32api, win32crypt
import base64, hashlib, os
import binascii, struct
from config.constant import *
from config.write_output import print_output, print_debug
from config.header import Header
from config.moduleInfo import Module... | Relin/LaZagne | Windows/src/LaZagne/softwares/chats/skype.py | Python | lgpl-3.0 | 4,298 | 0.034435 |
from . import adaptVor_driver
from .adaptVor_driver import AdaptiveVoronoiDriver
| westpa/westpa | src/westext/adaptvoronoi/__init__.py | Python | mit | 82 | 0 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | QingChenmsft/azure-cli | src/azure-cli-core/azure/cli/core/parser.py | Python | mit | 9,504 | 0.00263 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2019 Manas.Tech
# License granted by Canonical Limited
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# ... | ubuntu-core/snapcraft | snapcraft/plugins/v1/crystal.py | Python | gpl-3.0 | 4,665 | 0.001501 |
import numpy as np
import h5py
f = h5py.File('hdf5/data_streaming.h5', 'w')
ADSL_2008 = f.create_group("ADSL_Montsouris_2008_07_01")
# retreve: ADSL_2008 = f['ADSL_Montsouris_2008_07_01']
gvb_adsl_2008 = np.load('python_flows/flows_marked_GVB_juill_2008_ADSL_cut_BGP_AS.npy')
ADSL_2008.create_dataset('GVB', data=gvb_... | LouisPlisso/analysis_tools | old_create_hdf5_data_non_interacif.py | Python | gpl-3.0 | 2,240 | 0.003125 |
from task19_PageObject.MainPage import MainPage
def test_adding_and_deleting_from_cart(driver):
main_page = MainPage(driver)
main_page.open()
# Add 3 ducks to the cart in a loop
for i in range(1, 4):
# Click at the i-d duck
product_page = main_page.click_to_product_number(i)
p... | byakatat/selenium-training | task19_PageObject/test_task19.py | Python | apache-2.0 | 498 | 0.002008 |
from charmhelpers.core.hookenv import (
config,
unit_get,
)
from charmhelpers.contrib.network.ip import (
get_address_in_network,
is_address_in_network,
is_ipv6,
get_ipv6_addr,
)
from charmhelpers.contrib.hahelpers.cluster import is_clustered
PUBLIC = 'public'
INTERNAL = 'int'
ADMIN = 'admin'... | jiasir/openstack-trove | lib/charmhelpers/contrib/openstack/ip.py | Python | mit | 2,332 | 0 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | kevin-coder/tensorflow-fork | tensorflow/python/autograph/impl/conversion_test.py | Python | apache-2.0 | 6,484 | 0.005244 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | alexandrul-ci/robotframework | src/robot/parsing/populators.py | Python | apache-2.0 | 8,341 | 0.001079 |
"""Tests for the USB Discovery integration."""
from homeassistant.components.usb.models import USBDevice
conbee_device = USBDevice(
device="/dev/cu.usbmodemDE24338801",
vid="1CF1",
pid="0030",
serial_number="DE2433880",
manufacturer="dresden elektronik ingenieurtechnik GmbH",
description="Con... | jawilson/home-assistant | tests/components/usb/__init__.py | Python | apache-2.0 | 753 | 0 |
from bambu_mail.shortcuts import subscribe
def newsletter_optin(sender, user, **kwargs):
subscribe(
user.email,
list_id = 'signup',
double_optin = False,
send_welcome = False
) | iamsteadman/bambu-mail | bambu_mail/receivers.py | Python | apache-2.0 | 217 | 0.036866 |
'''Doc build constants'''
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
DOCKER_SOCKET = getattr(settings, 'DOCKER_SOCKET', 'unix:///var/run/docker.sock')
DOCKER_VERSION = getattr(settings, 'DOCKER_VERSION', 'auto')
DOCKER_IMAGE = getattr(settings, 'DOCKER_IMAGE', 'rtfd-buil... | titiushko/readthedocs.org | readthedocs/doc_builder/constants.py | Python | mit | 491 | 0.002037 |
from typing import KeysView
from baby_steps import given, then, when
from district42 import optional, schema
def test_dict_empty_keys():
with given:
sch = schema.dict
with when:
res = sch.keys()
with then:
assert res == KeysView([])
def test_dict_keys():
with given:
... | nikitanovosibirsk/district42 | tests/dict/test_dict_keys.py | Python | mit | 572 | 0 |
# encoding: 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 'Category.content'
db.add_column('core_category', 'content', self.gf('django.db.models.fields.TextF... | petrlosa/ella | ella/core/south_migrations/0005_auto__add_field_category_content__add_field_category_template.py | Python | bsd-3-clause | 11,864 | 0.008092 |
from __future__ import division, print_function, absolute_import
import pytest
import numpy as np
from numpy.testing import assert_, assert_equal, assert_allclose
import scipy.special as sc
from scipy.special._testutils import assert_func_equal
def test_wrightomega_nan():
pts = [complex(np.nan, 0),
c... | jamestwebber/scipy | scipy/special/tests/test_wrightomega.py | Python | bsd-3-clause | 3,616 | 0.000277 |
'''<h1>Library for surface x-ray diffraction simulations of superlattices</h1>
<p> The model is based on Fullertons algorithm for superlattices as
described in Phys. Rev. B vol. 45 p. 9292 (1992).
'''
# Programmed by Matts Bjorck 20091215
import numpy as np
import genx.models.sxrd
from genx.models.utils import f, rho... | haozhangphd/genx-py3 | genx/models/sxrd_mult.py | Python | gpl-3.0 | 12,753 | 0.008469 |
#!/usr/bin/python
import sys
sys.path.append('..')
from bcert_pb2 import *
import binascii
# fill out a minimal bitcoin cert
cert = BitcoinCert()
# first the data part (the part is later signed by the "higher level cert" or "the blockchain")
cert.data.version = '0.1'
cert.data.subjectname = 'Foo Inc.'
email = cert.... | bcpki/bitcoin | src/bcert/examples/mk_foo1_static.py | Python | mit | 2,934 | 0.023177 |
import csv
import random
import cassandra
from nose.tools import assert_items_equal
class DummyColorMap(object):
def __getitem__(self, *args):
return ''
def csv_rows(filename, delimiter=None):
"""
Given a filename, opens a csv file and yields it line by line.
"""
reader_opts = {}
i... | carlyeks/cassandra-dtest | cqlsh_tests/cqlsh_tools.py | Python | apache-2.0 | 2,124 | 0.001883 |
class StoreChangeLogger:
def __init__(self, store_name, context) -> None:
self.topic = f'{context.application_id}-{store_name}-changelog'
self.context = context
self.partition = context.task_id.partition
self.record_collector = context.state_record_collector
def log_change(self,... | wintoncode/winton-kafka-streams | winton_kafka_streams/state/logging/store_change_logger.py | Python | apache-2.0 | 503 | 0.001988 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
GeobricksTRMM
A QGIS plugin
Download TRMM daily data.
-------------------
begin : 2015-10-06
copyright : (C) ... | geobricks/geobricks_qgis_plugin_trmm | __init__.py | Python | gpl-2.0 | 1,510 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime, timedelta
import re
import types
from unittest import TestCase
from django.core.exceptions import ValidationError
from django.core.validators import (
BaseValidator, EmailValidator, MaxLengthValidator, MaxValueValidator... | wfxiang08/django178 | tests/validators/tests.py | Python | bsd-3-clause | 14,190 | 0.000918 |
#!/usr/bin/env python
# Install the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client
# To set up environmental variables, see http://twil.io/secure
ACCOUNT_SID = os.environ['TWILIO_ACCOUNT_SID']
AUTH_TOKEN = os.environ['TWILIO_AUTH_TOKEN']
client = Client(ACCOUNT_SID... | TwilioDevEd/api-snippets | notifications/register/send-notification/send-notification.7.x.py | Python | mit | 528 | 0 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | sjperkins/tensorflow | tensorflow/tensorboard/backend/event_processing/plugin_asset_util.py | Python | apache-2.0 | 3,278 | 0.006406 |
# -*- coding:utf-8 -*-
# @author yuding
# 2017-09-23
import re
import os
import shutil
import msvcrt
import traceback
def mkdir(path):
# 去除首位空格
path = path.strip()
# 去除尾部 \ 符号
path = path.rstrip("\\")
isExists = os.path.exists(path)
if not isExists:
os.makedirs(path)
... | yuuagh/pywork | 20171127/go.py | Python | gpl-3.0 | 4,158 | 0.015506 |
"""
.. module:: area_attribute
The **Area Attribute** Model.
PostgreSQL Definition
---------------------
The :code:`area_attribute` table is defined in the MusicBrainz Server as:
.. code-block:: sql
CREATE TABLE area_attribute ( -- replicate (verbose)
id SERIAL, -- PK
... | marios-zindilis/musicbrainz-django-models | musicbrainz_django_models/models/area_attribute.py | Python | gpl-2.0 | 1,946 | 0.004111 |
# -*- coding: utf-8 -*-
import time
import requests
import json
import logging
import threading
from .exceptions import ClientError
from .utils import to_unixtime
from .compat import to_unicode
logger = logging.getLogger(__name__)
class Credentials(object):
def __init__(self, access_key_id="", access_key_secret... | aliyun/aliyun-oss-python-sdk | oss2/credentials.py | Python | mit | 4,941 | 0.003036 |
GnuXzPackage ('clutter', '1.10.6',
sources = [ 'http://source.clutter-project.org/sources/clutter/1.10/%{name}-%{version}.tar.xz' ],
)
| bl8/bockbuild | packages/clutter.py | Python | mit | 136 | 0.058824 |
#!/usr/bin/env python
import sys
from manticore import issymbolic
from manticore.native import Manticore
"""
Replaces a variable that controls program flow with a tainted symbolic value. This
in turn explores all possible states under that variable's influence, and reports the
specific cmp/test instructions can be i... | montyly/manticore | examples/script/introduce_symbolic_bytes.py | Python | apache-2.0 | 2,875 | 0.001043 |
# Fabric file for the health monitor.
#
# This should only be used for deployment tasks. make should be
# sufficient for development.
import os
from fabric.api import env, task, roles, lcd, local, run, put
BASE_DIR = os.path.dirname(__file__)
env.path = ":".join([
'/home/forcer/bin/',
os.path.join(BASE_DIR,... | jorgenschaefer/healthmonitor | fabfile.py | Python | agpl-3.0 | 1,805 | 0 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either vers... | fabian-paul/PyEMMA | pyemma/coordinates/clustering/regspace.py | Python | lgpl-3.0 | 6,283 | 0.002547 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 12 11:57:45 2016
@author: katerinailiakopoulou
"""
import gensim
import logging
import sys
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
"""
The Finder finds which words are similar to the one given
based on the word2vec wo... | matzika/article-tagger-system | words_similarity_detector.py | Python | gpl-2.0 | 3,189 | 0.007839 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | adsorensen/girder | plugins/terms/server/__init__.py | Python | apache-2.0 | 3,937 | 0.003048 |
# -*- coding: utf-8 -*-
from pyload.plugin.Crypter import Crypter
class Dereferer(SimpleDereferer):
__name = "Dereferer"
__type = "crypter"
__version = "0.11"
__pattern = r'https?://([^/]+)/.*?(?P<LINK>(ht|f)tps?(://|%3A%2F%2F).+)'
__config = [("use_subfolder" , "bool", "Save package ... | ardi69/pyload-0.4.10 | pyload/plugin/crypter/Dereferer.py | Python | gpl-3.0 | 584 | 0.017123 |
#!/usr/bin/env vpython
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
import unittest
import mock
import merge_lib as merger
class MergeLibTest(unittest.TestCase... | chromium/chromium | testing/merge_scripts/code_coverage/merge_lib_test.py | Python | bsd-3-clause | 1,506 | 0.007968 |
#
# BitBox02 Electrum plugin code.
#
import hid
from typing import TYPE_CHECKING, Dict, Tuple, Optional, List, Any, Callable
from electrum_grs import bip32, constants
from electrum_grs.i18n import _
from electrum_grs.keystore import Hardware_KeyStore
from electrum_grs.transaction import PartialTransaction
from electr... | GroestlCoin/electrum-grs | electrum_grs/plugins/bitbox02/bitbox02.py | Python | gpl-3.0 | 27,314 | 0.002123 |
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/PyInstaller/hooks/hook-gi.repository.Champlain.py | Python | gpl-3.0 | 702 | 0.002849 |
# -*- coding: utf-8 -*-
"""
@author: kevinhikali
@email: hmingwei@gmail.com
"""
import tensorflow as tf
A = [[1, 2, 3, 4]]
B = [[2, 2, 3, 4]]
casted = tf.cast(tf.equal(A, B), dtype='float32')
with tf.Session() as sess:
print(sess.run(casted))
| kevinhikali/ml_kevin | tf/tf_cast.py | Python | gpl-3.0 | 250 | 0 |
from unittest2 import TestCase, skip
from bsPlugins.Annotate import AnnotatePlugin
import os
path = 'testing_files/'
class Test_AnnotatePlugin(TestCase):
def setUp(self):
self.plugin = AnnotatePlugin()
def test_with_signals(self):
self.plugin(**{'track':path+'KO50.bedGraph', 'assembly':'mm9',... | bbcf/bsPlugins | tests/test_Annotate.py | Python | gpl-3.0 | 717 | 0.011158 |
# -*- coding: utf-8 -*-
import random
import re
import time
import urlparse, urllib,urllib2,cookielib
from base64 import b64encode
import xbmc
import xbmcgui,xbmcaddon,os
__scriptID__ = 'plugin.video.live.magellan'
__addon__ = xbmcaddon.Addon(__scriptID__)
class cInputWindow(xbmcgui.WindowDialog):
def __init__(s... | mrquim/mrquimrepo | repo/plugin.video.live.magellan/unCaptcha.py | Python | gpl-2.0 | 14,966 | 0.029467 |
# Auto-clustering, suggested by Matt Terry
from skimage import io, color, exposure
from sklearn import cluster, preprocessing
import numpy as np
import matplotlib.pyplot as plt
url = 'http://blogs.mathworks.com/images/steve/2010/mms.jpg'
import os
if not os.path.exists('mm.jpg'):
print("Downloading M&M's...")
... | scikit-image/skimage-demos | mm_color_cluster.py | Python | bsd-3-clause | 2,030 | 0.000985 |
from allennlp.modules.encoder_base import _EncoderBase
from allennlp.common import Registrable
class Seq2VecEncoder(_EncoderBase, Registrable):
"""
A `Seq2VecEncoder` is a `Module` that takes as input a sequence of vectors and returns a
single vector. Input shape : `(batch_size, sequence_length, input_di... | allenai/allennlp | allennlp/modules/seq2vec_encoders/seq2vec_encoder.py | Python | apache-2.0 | 1,215 | 0.005761 |
from .main import main
# run the program
if __name__ == '__main__':
main() | william-fiset/Survival | __init__.py | Python | apache-2.0 | 79 | 0.012658 |
def sum_diagonal_principal(matrix):
return sum(matrix[i][i] for i in range(len(matrix)))
def sum_diagonal_secondary(matrix):
return sum(matrix[i][-i-1] for i in range(len(matrix)))
def diagonal(matrix):
s1 = sum_diagonal_principal(matrix)
s2 = sum_diagonal_secondary(matrix)
return "Principal Diago... | SelvorWhim/competitive | Codewars/PrincipalDiagonalVsSecondaryDiagonal.py | Python | unlicense | 396 | 0.007576 |
AUTH_URL = "https://quality.hubwoo.com/rest/auth/latest/session"
| AlexWPerfComm/Python-JIRA | const/Constants.py | Python | mit | 65 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
author: Alex Apostoli
based on https://github.com/hkm95/python-multiwii
which is under GPLv3
"""
import struct
import time
import sys
import re
class MSPItem:
def __init__(self, name, fmt, fields):
self.name = name
self.format ... | squilter/ardupilot | libraries/AP_MSP/Tools/pymsp.py | Python | gpl-3.0 | 18,847 | 0.014114 |
from setuptools import setup, find_packages
setup(
name="gevent-websocket",
version="0.3.6",
description="Websocket handler for the gevent pywsgi server, a Python network library",
long_description=open("README.rst").read(),
author="Jeffrey Gelens",
author_email="jeffrey@noppo.pro",
license... | imankulov/gevent-websocket | setup.py | Python | bsd-3-clause | 946 | 0.002114 |
default_app_config = 'forked_apps.catalogue.config.CatalogueConfig'
| OWStimpson/oscar_webstore | oscar_webstore_root/forked_apps/catalogue/__init__.py | Python | bsd-3-clause | 68 | 0 |
# Authors: Robert Luke <mail@robertluke.net>
#
# License: BSD (3-clause)
from configparser import ConfigParser, RawConfigParser
import glob as glob
import re as re
import os.path as op
import numpy as np
from ..base import BaseRaw
from ..constants import FIFF
from ..meas_info import create_info, _format_dig_points
f... | Teekuningas/mne-python | mne/io/nirx/nirx.py | Python | bsd-3-clause | 13,599 | 0 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.subsystem... | qma/pants | src/python/pants/backend/python/tasks/checkstyle/plugin_subsystem_base.py | Python | apache-2.0 | 886 | 0.006772 |
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
import maya.cmds as cmds
import constants as const
import rigBuildLib as complib
reload(complib)
class Component(object):
def __init__(self):
self.cmpdata = {}
self.compName = None
self.compSide = None
self.... | jamesbdunlop/defaultMayaLibrary | tools/rigComponentBuilder.py | Python | apache-2.0 | 4,466 | 0.005598 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest
i... | alexlo03/ansible | test/units/modules/network/f5/test_bigip_gtm_pool.py | Python | gpl-3.0 | 11,200 | 0.000446 |
import sys
from deriva.transfer import DerivaBackupCLI
DESC = "Deriva Catalog Backup Utility - CLI"
INFO = "For more information see: https://github.com/informatics-isi-edu/deriva-py"
def main():
cli = DerivaBackupCLI(DESC, INFO, hostname_required=True, config_file_required=False)
return cli.main()
if __na... | informatics-isi-edu/deriva-py | deriva/transfer/backup/__main__.py | Python | apache-2.0 | 361 | 0.00554 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import datetime
from frappe import _, msgprint, scrub
from frappe.defaults import get_user_permissions
from frappe.model.utils import get... | emmuchira/kps_erp | erpnext/accounts/party.py | Python | gpl-3.0 | 16,798 | 0.025063 |
# -*- coding: utf-8 -*-
"""
.. module:: djstripe.utils.
:synopsis: dj-stripe - Utility functions related to the djstripe app.
.. moduleauthor:: @kavdev, @pydanny, @wahuneke
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import datetime
from django.conf import settings
from... | jameshiew/dj-stripe | djstripe/utils.py | Python | mit | 4,844 | 0.002685 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Matt Martz <matt@sivel.net>
#
# 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'... | roadmapper/ansible | lib/ansible/modules/cloud/vmware/vmware_deploy_ovf.py | Python | gpl-3.0 | 22,956 | 0.002701 |
'''
main tuning script, LCLS
'''
import numpy as np
from ocelot.mint.mint import Optimizer, Action
from ocelot.mint.flash1_interface import FLASH1MachineInterface, FLASH1DeviceProperties, TestInterface
mi = FLASH1MachineInterface()
dp = FLASH1DeviceProperties()
#opt = Optimizer(mi, dp)
opt = Optimizer(TestInterfac... | sserkez/ocelot | mint/flash_tune.py | Python | gpl-3.0 | 2,806 | 0.024947 |
# -*- coding: utf-8 -*-
"""
:created: 27 Aug 2014
:author: Éric Piel
:copyright: © 2014 Éric Piel, Delmic
This file is part of Odemis.
.. license::
Odemis 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 ... | delmic/odemis | src/odemis/gui/conf/test/conf_test.py | Python | gpl-2.0 | 6,386 | 0.001097 |
# -*- coding: utf-8 -*-
import xbmc, xbmcgui, xbmcplugin
import urllib2,urllib,cgi, re
import HTMLParser
import xbmcaddon
import json
import traceback
import os
import cookielib
from BeautifulSoup import BeautifulStoneSoup, BeautifulSoup, BeautifulSOAP
import datetime
import sys
import time
import CustomPlayer
import c... | marcuschia/ShaniXBMCWork | other/livetvPlayer.py | Python | gpl-2.0 | 7,065 | 0.045294 |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: True if this Binary tree is Balanced, or false.
"""
def isBalanced(self, root):
# ... | Chasego/codirit | jiuzhang/Nine Chapters/3 Binary Tree & Divide Conquer/py/BalancedBinaryTree_rec.py | Python | mit | 873 | 0.001145 |
# This script will check http://services.scribus.net for broken assets
import lxml.html
url = "http://services.scribus.net"
doc = lxml.html.parse(url)
# pattern matching for relative urls: <a href="scribus_fonts.xml">
content_parsed = doc.xpath('href')
# also ignore scribusversions.xml
# Create a scraper class to ... | scribusproject/scribus-tools | resource-checker/scribus-services-check.py | Python | gpl-3.0 | 408 | 0.009804 |
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Index, Series, Timestamp, date_range
import pandas._testing as tm
class TestDatetimeIndex:
def test_indexing_with_datetime_tz(self):
# GH#8260
# support datetime64 with tz
idx = Index(date_range("20130101... | jreback/pandas | pandas/tests/indexing/test_datetime.py | Python | bsd-3-clause | 7,714 | 0.001037 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.