code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
"""This module can be used for finding similar code"""
import re
import rope.refactor.wildcards
from rope.base import libutils
from rope.base import codeanalyze, exceptions, ast, builtins
from rope.refactor import (patchedast, wildcards)
from rope.refactor.patchedast import MismatchedTokenError
class BadNameInCheck... | mcepl/rope | rope/refactor/similarfinder.py | Python | lgpl-3.0 | 12,522 |
# -*- coding: utf-8 -*-
#
# BRisa UPnP documentation build configuration file, created by
# sphinx-quickstart on Mon May 4 11:21:11 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pick... | MIRAvzw/qt-brisa | doc/docSource/conf.py | Python | lgpl-3.0 | 6,284 |
import tkinter as tk
import tkinter.ttk as ttk
def NewFlight():
from Controller import LoadNewFlightPage
LoadNewFlightPage(mainPage)
def LogBook():
from Controller import LoadLogBookPage
LoadLogBookPage(mainPage)
def CreateMainPage():
global mainPage
mainPage = tk.Tk()
m... | Coops1980/Logbook | Main.py | Python | unlicense | 2,472 |
#!/usr/bin/env python
import sys, getopt, csv, pprint
from pymongo import MongoClient
import threading
import time
import traceback
_THREAD_LIMIT = 10
print_lock = threading.Lock()
global_mongo = MongoClient(max_pool_size=_THREAD_LIMIT)
tsem = threading.Semaphore(value=_THREAD_LIMIT)
def usage(msg):
if msg !=... | manchicken/gist_per_day | utils/threaded_csv_into_mongo.py | Python | unlicense | 2,553 |
#!/usr/bin/env python
#This example is original obtained from
# http://www.michael-noll.com/tutorials/writing-an-hadoop-mapreduce-program-in-python/
from operator import itemgetter
import sys
current_word = None
current_count = 0
word = None
# input comes from STDIN
for line in sys.stdin:
# remove leading and... | rchaudhari/hadoop_learning | wc_streaming/reducer.py | Python | unlicense | 1,158 |
# -*- coding: Latin-1 -*-
#!/usr/bin/env python
"""PyUdd, a python module for OllyDbg .UDD files
Ange Albertini 2010, Public domain
"""
__author__ = 'Ange Albertini'
__contact__ = 'ange@corkami.com'
__revision__ = "$Revision$"
__version__ = '0.1 r%d'
import struct
HDR_STRING = "Mod\x00"
FTR_STRING... | foone/3dmmInternals | generate/lib/pyudd.py | Python | unlicense | 17,726 |
from util import http, hook
import time
import datetime
@hook.command(autohelp=False)
def countdown(inp, say=None):
".countdown -- countdown timer for game releases"
curtime = time.time()
items=(
('test1','Test Event One','25 dec 14 00 00'),
('test2','Test Event Two','22 nov 16 00 00'),
)
dict_da... | andyeff/skybot | plugins/countdown.py | Python | unlicense | 1,465 |
# stupid 2.7.2 by peterm, patch by Smack
# http://robotgame.org/viewrobot/5715
import random
import math
import rg
def around(l):
return rg.locs_around(l)
def around2(l):
return [(l[0]+2, l[1]), (l[0]+1, l[1]+1), (l[0], l[1]+2), (l[0]-1, l[1]+1),
(l[0]-2, l[1]), (l[0]-1, l[1]-1), (l[0], l[1]-2), (l[0]+1... | andrewgailey/robogen | robogen/rgkit/backup bots/stupid272.py | Python | unlicense | 6,333 |
'''
Problem: Given an int, num, swap it's even bits with it's odd bits (ie swap bit 1 with bit 2, bit 3
with bit 4, etc -> 0110 0010 becomes 1001 0001)
Solution: Brute force is to iterate in pairs and swap said pairs. This means you are performing
32/64 swaps where you mask even and mask odd and shift them and ... | joeghodsi/interview-questions | cracking-the-coding-interview/ch5-bit-manipulation/x5.6-swap-even-odd-bits.py | Python | unlicense | 789 |
import libtcod.libtcodpy as libtcod
from random import randint
SCREEN_WIDTH = 40
SCREEN_HEIGHT = 20
LIMIT_FPS = 20
MAP_WIDTH = 80
MAP_HEIGHT = 45
ROOM_MAX_SIZE = 10
ROOM_MIN_SIZE = 10
MAX_ROOMS = 30
MAX_ROOM_MONSTERS = 3
FOV_ALGO = libtcod.FOV_SHADOW
FOV_LIGHT_WALLS = True
TORCH_RADIUS = 8
void_color = libtcod.Co... | gambl0r/roguebowl | rbowl.py | Python | unlicense | 14,250 |
# Copyright 2011 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | e0ne/cinder | cinder/api/contrib/volume_transfer.py | Python | apache-2.0 | 8,571 |
# -*- coding: utf-8 -*-
# (C) Copyright 2014 Voyager Search
#
# 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 l... | voyagersearch/voyager-py | processing/tasks/report_duplicate_items.py | Python | apache-2.0 | 22,408 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: Apache 2.0 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import os
try:
from urllib.request import urlopen
except ImportError:
from urllib import u... | kovidgoyal/html5-parser | genencodings.py | Python | apache-2.0 | 1,197 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | UManPychron/pychron | pychron/pipeline/plot/plotter/ideogram.py | Python | apache-2.0 | 35,999 |
__author__ = 'wenjusun'
import web
import sys
db = web.database(dbn='mysql',db='cas_statistics',host='localhost',user='motodbu',passwd='idm1512d')
EVENT_TYPES={'0':'login','1':'signup','2':'verify_email'}
class DataProcessor():
def __init__(self,dtstr):
self.dtstr = dtstr
"1159,159,19"
def parse... | swenker/studio | shijing_img/source/handle_cas_statistics.py | Python | apache-2.0 | 3,123 |
#
# 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
# distri... | svn2github/pylucene | jcc/jcc2/python.py | Python | apache-2.0 | 75,811 |
# -*- coding: utf-8 -*-
import httplib
import json
import yaml
from mysql import *
from industry import industry_typeid
from materials import *
# def printGroups(resJson):
# items = resJson['items']
# for i in items:
# print "name: " + i['name'] + " url:" + i['href']
#
# def printCategory(resJson):
# ... | after1990s/little_utils | EveItem/main.py | Python | apache-2.0 | 6,571 |
from immuno.mhc_formats import parse_netmhc_stdout
from immuno.peptide_binding_measure import (
IC50_FIELD_NAME,
PERCENTILE_RANK_FIELD_NAME,
)
def test_mhc_stdout():
s = """
# Affinity Threshold for Strong binding peptides 50.000',
# Affinity Threshold for Weak binding peptides 500.000',
# Ran... | hammerlab/immuno | test/test_mhc_formats.py | Python | apache-2.0 | 2,503 |
import fetch_from_twse
| steny138/twss | twss/__init__.py | Python | apache-2.0 | 23 |
import os
import mock
import pytest
import bcrypt
def test_gensalt_basic(monkeypatch):
urandom = mock.Mock(return_value=b"0000000000000000")
monkeypatch.setattr(os, "urandom", urandom)
assert bcrypt.gensalt() == b"$2a$12$KB.uKB.uKB.uKB.uKB.uK."
@pytest.mark.parametrize(("rounds", "expected"), [
(4... | dstufft/bcrypt | tests/test_bcrypt.py | Python | apache-2.0 | 6,744 |
from azure.storage import AccessPolicy, SharedAccessPolicy, SignedIdentifier, SignedIdentifiers
from azure.storage.blob import BlobService, ContainerSharedAccessPermissions
# The name of the new Shared Access policy
policy_name = 'readandlistonly'
# The Storage Account Name
storage_account_name = 'myaccountname'
stora... | Blackmist/hdinsight-azure-storage-sas | Python/SASToken.py | Python | apache-2.0 | 1,858 |
from __future__ import print_function
import requests
import json
import time
import codecs
class EvohomeClient:
def __init__(self, username, password):
self.username = username
self.password = password
self.user_data = None
self.full_data = None
self.gateway_data = None
... | sander76/evohome-client | evohomeclient/__init__.py | Python | apache-2.0 | 7,731 |
# Copyright 2022 Google LLC. 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 applicable law o... | GoogleCloudPlatform/declarative-resource-client-library | python/services/cloudresourcemanager/project.py | Python | apache-2.0 | 5,106 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic string exercises
# Fill in the code for the functions below. main() is already se... | starlure/google_python_class | basic/string1.py | Python | apache-2.0 | 3,650 |
#!/usr/bin/env python3
# NOTE: this example requires PyAudio because it uses the Microphone class
import speech_recognition as sr
# this is called from the background thread
def callback(recognizer, audio):
# received audio data, now we'll recognize it using Google Speech Recognition
try:
# for testi... | xe1gyq/GiekIs | examples/au.py | Python | apache-2.0 | 1,636 |
#!/usr/bin/env python
"""Reads iPhoto library info, and exports photos and movies."""
# Original work Copyright 2010 Google Inc.
# Modified work Copyright 2014 Luke Hagan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... | lhagan/phoshare | phoshare/phoshare_main.py | Python | apache-2.0 | 44,326 |
from fabric.api import hosts, run, sudo, local
from fabric.contrib.console import confirm
from fabric.utils import puts,warn
DEV_PROVISIONING_UUID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
DEV_SIGN = "Mobi Ten"
DEV_APP_NAME = "Gym Mama"
DEV_APP_ID = 'com.mobiten.gym_mama'
TITANIUM_SDK_VERSION = '1.5.1'
IPHONE_SDK_VERS... | leonyeh/CoffeeScript-Hello-World | fabfile.py | Python | apache-2.0 | 1,250 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-09 16:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='City',... | LiFengPro/trazip | foundation/migrations/0001_initial.py | Python | apache-2.0 | 668 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, 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/L... | KarimAllah/nova | nova/tests/test_xenapi.py | Python | apache-2.0 | 69,840 |
#!/usr/bin/env python
#
# Copyright 2015 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 requir... | googleads/googleads-python-lib | examples/ad_manager/v202202/creative_set_service/associate_creative_set_to_line_item.py | Python | apache-2.0 | 1,986 |
#!/usr/bin/env python
#coding:utf-8
"""
Purpose: ccoin Modules Package
Author: xczh <christopher.winnie2012@gmail.com>
Copyright (c) 2015 xczh. All rights reserved.
""" | xczh/ccoin | modules/__init__.py | Python | apache-2.0 | 185 |
from django.core import formfields, validators
from django.core.mail import mail_admins, mail_managers
from django.core.exceptions import Http404, ObjectDoesNotExist
from django.core.extensions import DjangoContext, render_to_response
from django.models.auth import users
from django.models.comments import comments, fre... | tungvx/deploy | Django-0.90/django/contrib/comments/views/comments.py | Python | apache-2.0 | 16,510 |
# Copyright 2014 Huawei Technologies Co. Ltd
#
# 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... | kidchang/compassv2-api | compass/actions/util.py | Python | apache-2.0 | 4,152 |
from sqlalchemy import Column, MetaData, Table
from sqlalchemy import DateTime, Integer, String, Text
from sqlalchemy import ForeignKeyConstraint, UniqueConstraint
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import backref, dynamic_loader, mapper, relation
from sqlalchemy.orm.colle... | dongjinleekr/wpdb | wpdb.py | Python | apache-2.0 | 16,291 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | f_net/models_test.py | Python | apache-2.0 | 13,843 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tswast/google-cloud-python | texttospeech/google/cloud/texttospeech_v1beta1/__init__.py | Python | apache-2.0 | 1,400 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
import traceback
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render
from django.contrib.auth import logout as django_logout
from restclients_core.exceptions import DataFailu... | uw-it-aca/myuw | myuw/views/page.py | Python | apache-2.0 | 6,010 |
from django.apps import AppConfig
class NexusFrontEndConfig(AppConfig):
name = 'nexus_front_end'
| utarsuno/urbtek | nexus_django/nexus_front_end/apps.py | Python | apache-2.0 | 103 |
from django.conf.urls.defaults import *
from django.contrib import admin
import dbindexer
handler500 = 'djangotoolbox.errorviews.server_error'
# django admin
admin.autodiscover()
# search for dbindexes.py in all INSTALLED_APPS and load them
dbindexer.autodiscover()
urlpatterns = patterns('',
url('^_ah/warmup$',... | LookThisCode/DeveloperBus | Season 2013/Brazil/Projects/QueroMe-master/urls.py | Python | apache-2.0 | 1,669 |
from __future__ import print_function
import torch
import torch.nn as nn
from torch.autograd import Variable
import matplotlib.pyplot as plt
import torch.optim as optim
import read_image
from Net import Net
from CONSTANT import TRAIN_BATCH_SIZE, TEST_BATCH_SIZE, EPOCH, CALCULATE_LOSS
from tensorboard_logger import con... | yt4766269/pytorch_zoo | LeNet/train.py | Python | apache-2.0 | 1,456 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import multiprocessing, Queue
import signal, time
import setting
from socketserver import SocketServer
from tunserver import TunServer
def sigHandler(signum, frame):
print "signal %s received, client going to shutdown" % signum
setting.running = False
if __nam... | ayouwei/minivpn | server/server.py | Python | apache-2.0 | 857 |
# Copyright 2017 ETH Zurich
#
# 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, sof... | chaehni/scion-coord | python/local_gen.py | Python | apache-2.0 | 6,540 |
# In forms.py...
from appfd.models import Basemap
from django.forms import CharField, FileField, Form, ModelChoiceField, URLField
from timezone_field import TimeZoneFormField
class BasemapForm(Form):
basemap = ModelChoiceField(to_field_name="name", queryset=Basemap.objects.all())
class LinkForm(Form):
data = ... | FirstDraftGIS/firstdraft | projfd/appfd/forms.py | Python | apache-2.0 | 726 |
"""The tests for the Home Assistant API component."""
# pylint: disable=protected-access
import json
from unittest.mock import patch
from aiohttp import web
import pytest
import voluptuous as vol
from homeassistant import const
from homeassistant.bootstrap import DATA_LOGGING
import homeassistant.core as ha
from home... | lukas-hetzenecker/home-assistant | tests/components/api/test_init.py | Python | apache-2.0 | 18,138 |
import os
from boxsdk import Client
from boxsdk.exception import BoxAPIException
from boxsdk.object.collaboration import CollaborationRole
from demo.auth import authenticate
def run_user_example(client):
# 'me' is a handy value to get info on the current authenticated user.
me = client.user(user_id='me').get(... | box/box-python-sdk | demo/example.py | Python | apache-2.0 | 9,973 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | linear_dynamical_systems/process_mit_bih.py | Python | apache-2.0 | 3,056 |
#!env python
import os
import sys
sys.path.append(
os.path.join(
os.environ.get( "SPLUNK_HOME", "/opt/splunk/6.1.3" ),
"etc/apps/framework/contrib/splunk-sdk-python/1.3.0",
)
)
from collections import Counter, OrderedDict
from math import log
from nltk import tokenize
import execnet
import json
from splunkl... | nlproc/splunkml | bin/mcpredict.py | Python | apache-2.0 | 2,357 |
import collections
import copy
import functools
import logging
import time
import kafka.common
from kafka.common import (TopicAndPartition, BrokerMetadata,
ConnectionError, FailedPayloadsError,
KafkaTimeoutError, KafkaUnavailableError,
Leade... | mutability/kafka-python | kafka/client.py | Python | apache-2.0 | 21,917 |
#
# Copyright 2018 the original author or 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... | opencord/voltha | tests/atests/common/preprovisioning.py | Python | apache-2.0 | 8,118 |
from JumpScale import j
try:
import ujson as json
except:
import json
class CacheFactory:
def __init__(self):
self.__jslocation__ = "j.tools.cache"
def get(self, db, expiration=300):
"""
db is keyvalue stor to use
e.g. j.tools.cache.get(j.servers.kvs.getRedisStore(na... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/cache/Cache.py | Python | apache-2.0 | 1,412 |
# Copyright 2018 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 by applicable law or a... | google/loaner | loaner/web_app/backend/api/messages/template_messages.py | Python | apache-2.0 | 2,625 |
# 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 twitter.common.... | dbentley/pants | src/python/pants/subsystem/subsystem.py | Python | apache-2.0 | 6,819 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | cg31/tensorflow | tensorflow/contrib/metrics/python/ops/metric_ops.py | Python | apache-2.0 | 141,058 |
#!/usr/bin/python
# vi: ts=4 expandtab
#
# Copyright (C) 2012 Yahoo! 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/l... | yahoo/Image-Builder | build.py | Python | apache-2.0 | 15,634 |
# Copyright (c) 2020 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 appli... | luotao1/Paddle | python/paddle/distributed/fleet/runtime/the_one_ps.py | Python | apache-2.0 | 57,329 |
"""
noop_returner
~~~~~~~~~~~~~
A returner that does nothing which is used to test the salt-master `event_return` functionality
"""
import logging
import salt.utils.jid
log = logging.getLogger(__name__)
__virtualname__ = "runtests_noop"
def __virtual__():
return True
def event_return(events):
log.debu... | saltstack/salt | tests/integration/files/returners/noop_returner.py | Python | apache-2.0 | 704 |
from marshmallow import Schema, fields, post_load
from .base import BaseModel
class ResultSchema(Schema):
hid = fields.Str()
experiment = fields.Str()
dataset = fields.Str()
validation_scheme = fields.Str()
model_type = fields.Str()
metric_type = fields.Str()
metric_value = fields.Number(a... | mljar/mljar-api-python | mljar/model/result.py | Python | apache-2.0 | 2,694 |
# Copyright 2013-2017 DataStax, 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 writi... | coldeasy/python-driver | tests/integration/cqlengine/test_batch_query.py | Python | apache-2.0 | 8,003 |
"""
WSGI config for demoproject 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | raphaelm/django-i18nfield | demoproject/demoproject/wsgi.py | Python | apache-2.0 | 399 |
# mxacquisition.py
#
# Copyright (C) 2014 Diamond Light Source, Karl Levik
#
# 2014-09-24
#
# Methods to store MX acquisition data
#
import copy
from ispyb.sp.acquisition import Acquisition
from ispyb.strictordereddict import StrictOrderedDict
class MXAcquisition(Acquisition):
"""MXAcquisition provides metho... | DiamondLightSource/ispyb-api | src/ispyb/sp/mxacquisition.py | Python | apache-2.0 | 9,112 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | jiahaoliang/group-based-policy | gbpservice/tests/contrib/gbpfunctests/testcases/tc_gbp_ri_func_4.py | Python | apache-2.0 | 3,891 |
import gizeh
surface = gizeh.Surface(width=320, height=260)
circle = gizeh.circle (r=40, # radius, in pixels
xy= [156, 200], # coordinates of the center
fill= (1,0,0)) # 'red' in RGB coordinates
circle.draw( surface ) # draw the circle on the surface
surface.get_npimage() #... | mmenz/michaelmenz | spare-parts/animatedgifs.py | Python | apache-2.0 | 420 |
# coding=utf-8
import pygal
from present.miniPresent import MiniPresent
__author__ = 'Iurii Sergiichuk'
result_file = open('./results.txt', 'w+')
class EncryptedTextResultHolder(object):
def __init__(self, encrypted_text):
"""
:type encrypted_text str
"""
self.encrypted_text = e... | xSAVIKx/PRESENT-cipher | tests/miniPresentTest.py | Python | apache-2.0 | 5,532 |
"""
Copyright 2015 Sai Gopal
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
dist... | EnduranceIndia/ratelimitd | ProfileLookups/HTTPLookup.py | Python | apache-2.0 | 1,328 |
# Copyright 2021 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-google/cirq_google/engine/abstract_program.py | Python | apache-2.0 | 6,521 |
#!/usr/bin/python
import Adafruit_BBIO.ADC as ADC
import time
import os
ADC.setup()
n = 100
count = 0
start = [1]*n
print('Calibrating...')
# Create first list of n voltage readings
while True:
voltage = ADC.read("P9_39")
voltage = 2*1.8*voltage
start.pop(0)
start.append(voltage)
count = count... | Duke-Medical-Instrumentation/Respi-Rite | Software/FinalCode/debugFiles/debugAlgorithm.py | Python | apache-2.0 | 2,033 |
#!/usr/bin/env python
"""
This is an Ansible dynamic inventory for OpenStack.
It requires your OpenStack credentials to be set in clouds.yaml or your shell
environment.
"""
from __future__ import print_function
from collections import Mapping
import json
import os
from keystoneauth1.exceptions.catalog import Endpo... | abutcher/openshift-ansible | playbooks/openstack/inventory.py | Python | apache-2.0 | 8,542 |
# Copyright 2020 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 by applicable law or a... | google/timesketch | api_client/python/timesketch_api_client/user.py | Python | apache-2.0 | 3,300 |
# -*- 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-grafeas | grafeas/grafeas_v1/services/grafeas/transports/__init__.py | Python | apache-2.0 | 1,131 |
"""Constants for Google Assistant."""
from homeassistant.components import (
binary_sensor,
camera,
climate,
cover,
fan,
group,
input_boolean,
light,
lock,
media_player,
scene,
script,
switch,
vacuum,
)
DOMAIN = 'google_assistant'
GOOGLE_ASSISTANT_API_ENDPOINT = ... | aequitas/home-assistant | homeassistant/components/google_assistant/const.py | Python | apache-2.0 | 3,816 |
# Задача 3. Вариант 10.
# Напишите программу, которая выводит имя "Игорь Васильевич Лотарев", и запрашивает его псевдоним. Программа должна сцеплять две эти строки и выводить полученную строку, разделяя имя и псевдоним с помощью тире.
# Donkor A.H.
# 14.04.2016
print("Итак,гость нынешнего дня является русский по... | Mariaanisimova/pythonintask | PMIa/2015/Donkor_A_H/task_3_10.py | Python | apache-2.0 | 928 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | brchiu/tensorflow | tensorflow/python/data/experimental/kernel_tests/optimization/map_vectorization_test.py | Python | apache-2.0 | 20,093 |
"""Reports memory utilization details for given container."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import click
from treadmill import psmem
from treadmill import cgutils
from treadmill import met... | bretttegart/treadmill | lib/python/treadmill/cli/admin/diag.py | Python | apache-2.0 | 4,331 |
# Copyright 2020 Google LLC. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | tensorflow/tfx | tfx/experimental/templates/penguin/models/model.py | Python | apache-2.0 | 9,176 |
# -*- coding: utf-8 -*-
#
# Copyright 2014 - Mirantis, 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 requir... | dennybaa/mistral | mistral/api/hooks/content_type.py | Python | apache-2.0 | 1,456 |
'''
Created on 2015/11/30
:author: hubo
Process events multi-threaded or multi-processed
'''
from vlcp.event.runnable import RoutineContainer
import multiprocessing
import threading
import socket
import signal
import errno
import sys
from vlcp.event.event import Event, withIndices, M_
from vlcp.event.core import POLL... | hubo1016/vlcp | vlcp/utils/connector.py | Python | apache-2.0 | 19,678 |
# Copyright 2018 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 by applicable law or a... | GoogleCloudPlatform/appengine-blobstoremgmt-python | src/main.py | Python | apache-2.0 | 730 |
# -*- coding: utf-8 -*-
import itertools
import json
import re
import urllib.request
import urllib.parse
import yaml
from psycopg2.errors import UniqueViolation, InFailedSqlTransaction
# Class to transform address -> address_id. The class takes care of caching and
# address normalization (e.g lowercase, remove 'Slove... | verejnedigital/verejne.digital | data/geocoder.py | Python | apache-2.0 | 14,851 |
# Copyright 2019 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 applic... | keras-team/keras | keras/engine/compile_utils.py | Python | apache-2.0 | 26,900 |
# Copyright (c) 2012 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.apache.org/licenses/LICENSE-2.0
#
# Unless ... | rajalokan/nova | nova/compute/resource_tracker.py | Python | apache-2.0 | 47,854 |
#
# This file is 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
# distr... | TresAmigosSD/SMV | src/test/python/testModuleHash/after/src/main/python/stage/modules.py | Python | apache-2.0 | 4,078 |
import json
import os
import re
import tempfile
from typing import List
import pytest
from plenum.common.signer_did import DidSigner
from indy_client.test.agent.acme import ACME_ID, ACME_SEED
from indy_client.test.agent.acme import ACME_VERKEY
from indy_client.test.agent.faber import FABER_ID, FABER_VERKEY, FABER_SEED... | TechWritingWhiz/indy-node | indy_client/test/cli/conftest.py | Python | apache-2.0 | 46,041 |
def hello_world():
"Function that says hello."
print("Hello, world!")
| evanmiltenburg/python-for-text-analysis | Extra_Material/Examples/Separate_Files/main_dir_script.py | Python | apache-2.0 | 78 |
from __future__ import unicode_literals
import logging
import os
# TODO: Remove entirely if you don't register GStreamer elements below
import pygst
pygst.require('0.10')
import gst
import gobject
from mopidy import config, ext
__version__ = '0.1.0'
# TODO: If you need to log, use loggers named after the current ... | gimunu/mopidy-lcdplate | mopidy_lcdplate/__init__.py | Python | apache-2.0 | 1,698 |
from sys import maxsize
class Group:
def __init__(self, name=None, header=None, footer=None, id=None):
self.name = name
self.header = header
self.footer = footer
self.id = id
def __repr__(self):
return "%s:%s:%s:%s" % (self.id, self.name, self.header, self.footer)
... | AklerQ/python_training | model/group.py | Python | apache-2.0 | 674 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py | Python | apache-2.0 | 35,143 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/ghost-userspace | experiments/scripts/shenango.py | Python | apache-2.0 | 4,128 |
"""HTTP views to interact with the entity registry."""
import voluptuous as vol
from homeassistant.components import websocket_api
from homeassistant.components.websocket_api.const import ERR_NOT_FOUND
from homeassistant.components.websocket_api.decorators import (
async_response,
require_admin,
)
from homeass... | postlund/home-assistant | homeassistant/components/config/entity_registry.py | Python | apache-2.0 | 4,955 |
# Copyright 2011, VMware, 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 by... | MaximNevrov/neutron | neutron/common/utils.py | Python | apache-2.0 | 22,681 |
from flask import Flask, request, g, session, redirect, abort, Response
from datetime import datetime
from functools import wraps
import base64
app = Flask(__name__)
app.config.from_envvar('WEB_CONF')
def authenticate(f):
@wraps(f)
def wrapper(*args, **kwargs):
v = request.headers.get('authorization')
... | alexmilowski/duckpond | duckpond/apps/service/app.py | Python | apache-2.0 | 1,161 |
# Copyright (c) 2015 Cloudera, Inc. All rights reserved.
# Validates table stored on the LocalFileSystem.
#
import pytest
from subprocess import check_call
from tests.common.impala_test_suite import ImpalaTestSuite
from tests.common.test_dimensions import create_single_exec_option_dimension
from tests.common.skip impor... | cloudera/recordservice | tests/query_test/test_multiple_filesystems.py | Python | apache-2.0 | 1,985 |
try:
VERSION = __import__("pkg_resources").get_distribution("gitboard").version
except Exception:
VERSION = "unknown"
| dcramer/gitboard | gitboard/__init__.py | Python | apache-2.0 | 126 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sfpython.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| simeonf/sfpython | sfpython/manage.py | Python | apache-2.0 | 251 |
from __future__ import absolute_import
import datetime
from typing import Any, List
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.timezone import now as timezone_now
from zerver.lib.digest import enqueue_emails, DIGEST_CUTOFF
from zerver.lib.logging_util impor... | verma-varsha/zulip | zerver/management/commands/enqueue_digest_emails.py | Python | apache-2.0 | 728 |
# -*- 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-dialogflow-cx | samples/generated_samples/dialogflow_v3_generated_pages_list_pages_async.py | Python | apache-2.0 | 1,481 |
#!/usr/bin/env python
# Copyright 2018 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... | googleapis/python-bigtable | samples/quickstart/main.py | Python | apache-2.0 | 1,868 |
import time
from .util import json_loads
MAX_RETRY_COUNT = 5
RETRY_SLEEP_TIME = 0.1
class parseJson:
def __call__(self, func):
def replacement(*args, **kwargs):
response = func(*args, **kwargs)
return json_loads(response)
return replacement
class retry:
def __call... | galaxyproject/pulsar | pulsar/client/decorators.py | Python | apache-2.0 | 809 |
from .asynchronous import AsynchronousRabbitConnector
| IS-ENES-Data/esgf-pid | esgfpid/rabbit/asynchronous/__init__.py | Python | apache-2.0 | 55 |
# Copyright (c) 2017 Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''Runner for debugging with J-Link.'''
import os
import tempfile
import sys
from west import log
from runners.core import ZephyrBinaryRunner, RunnerCaps, \
BuildConfiguration
DEFAULT_JLINK_EXE = 'JLink.exe' if sys.platform == 'win32' ... | explora26/zephyr | scripts/west_commands/runners/jlink.py | Python | apache-2.0 | 5,887 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import logging
import json
import os
import traceback
import time
import datetime
from socket import AddressFamily
try:
import psutil
except ImportError:
print("The reporter requires ps... | ujvl/ray-ng | python/ray/reporter.py | Python | apache-2.0 | 6,847 |