content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
# 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... | 37.004556 | 85 | 0.620499 | [
"Apache-2.0"
] | OcrOrg/PaddleOCR | tools/infer/utility.py | 16,245 | Python |
from django.db import models
import string, random, datetime
from profiles.models import UserProfile, Location, Surcharges, User
from decimal import *
from menu.models import Product, Entree, Pizza, PizzaTopping, Side
from localflavor.us.models import PhoneNumberField, USStateField, USZipCodeField
#modify this to che... | 38.437037 | 129 | 0.664097 | [
"MIT"
] | hellojerry/pizzatime | src/orders/models.py | 5,189 | Python |
import json
import os
from golem.core import utils
from golem.test_runner import test_runner
from golem.report.execution_report import create_execution_directory
from golem.report.execution_report import create_execution_dir_single_test
from golem.report import test_report
from golem.report.test_report import get_tes... | 41.2 | 96 | 0.628406 | [
"MIT"
] | HybridAU/golem | tests/report/test_report_test.py | 6,386 | Python |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
class Stage5(torch.nn.Module):
def __init__(self):
super(Stage5, self).__init__()
self.layer1 = torch.nn.Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
self._initialize_weights()
... | 34.966667 | 97 | 0.585319 | [
"MIT"
] | MonicaGu/pipedream | runtime/image_classification/models/vgg16/gpus=16_straight/stage5.py | 1,049 | Python |
import twl
wolf = twl.Wolf()
def split(wolf, end=7):
return [wolf.len(n)() for n in range(2, end+1)]
def spell(ltrs, wild=0):
return split(wolf.wild(ltrs, wild), len(ltrs)+wild)
def _munge(func, fix, ltrs, wild=0):
return split(func(fix).wild(fix+ltrs, wild), len(fix+ltrs)+wild)
def starts(fix, ltr... | 19.676471 | 68 | 0.638266 | [
"MIT"
] | esoterik0/scrabble-comp | use.py | 669 | Python |
from functools import lru_cache
from injector import inject
from .config_parameter_base import ConfigParameterBase
from ...data.repository import RepositoryProvider
from ...dependency import IScoped
from ...exceptions import RequiredClassException
class ConfigService(IScoped):
@inject
def __init__(self,
... | 34.066667 | 98 | 0.715264 | [
"MIT"
] | PythonDataIntegrator/pdip | pdip/configuration/services/config_service.py | 1,022 | Python |
"""Notification."""
from models.metric_notification_data import MetricNotificationData
class Notification:
"""Handle notification contents and status."""
def __init__(self, report, metrics, destination_uuid, destination):
"""Initialise the Notification with the required info."""
self.report_... | 35.571429 | 93 | 0.678715 | [
"Apache-2.0"
] | m-zakeri/quality-time | components/notifier/src/models/notification.py | 996 | Python |
import os
import imageio
import numpy as np
from PIL import Image
from torch.autograd import Variable
from torchvision.utils import save_image
def create_gif(image_path):
frames = []
gif_name = os.path.join("images", 'mnist1.gif')
image_list = os.listdir(image_path)
sorted(image_list)
for image... | 26.106383 | 90 | 0.691932 | [
"Apache-2.0"
] | GodWriter/GAN-Pytorch | cgan/utils.py | 1,227 | Python |
import RPi.GPIO as GPIO
import hx711
import matplotlib.pyplot as plt
# Read initial calibration and tare weight data then display the plot.
def main():
GPIO.setmode(GPIO.BCM)
hx = hx711.HX711(dout_pin=5, pd_sck_pin=6)
zero_the_scale(hx)
calibrate_scale(hx)
(tare_weight, total_weight) = get_tare_an... | 33.108696 | 75 | 0.645765 | [
"MIT"
] | mmachenry/pie-pie-chart | pie_pie_chart.py | 3,046 | Python |
import math
from enforce_typing import enforce_types
from engine import SimStrategyBase
from util.constants import S_PER_HOUR
@enforce_types
class SimStrategy(SimStrategyBase.SimStrategyBase):
def __init__(self, no_researchers=2):
#===initialize self.time_step, max_ticks====
super().__init__()
... | 42.209302 | 131 | 0.656749 | [
"Apache-2.0"
] | opscientia/darcspice | assets/netlists/opsci_profit_sharing/SimStrategy.py | 1,815 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from ... | 36.967568 | 201 | 0.663109 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | 6,839 | Python |
"""
Support for Xiaomi Gateways.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/xiaomi_aqara/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.discovery import SERVICE_XIAOMI_GW
from homeassista... | 33.006006 | 77 | 0.672186 | [
"Apache-2.0"
] | phispi/home-assistant | homeassistant/components/xiaomi_aqara.py | 10,991 | Python |
from abc import ABC, abstractmethod
import numpy as np
from .constants import EPSILON
import torch
class Loss(ABC):
def __init__(self, expected_output, predict_output):
self._expected_output = expected_output
self._predict_output = predict_output
@abstractmethod
def get_loss(self):
... | 25.875 | 78 | 0.724638 | [
"MIT"
] | exitudio/neural-network-pytorch | exit/losses.py | 621 | Python |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... | 30.421053 | 74 | 0.693772 | [
"Apache-2.0"
] | Aarjav-Jain/oppia | scripts/linters/test_files/invalid_python_three.py | 1,156 | Python |
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as ip
from scipy.ndimage import gaussian_filter1d
from utils.helpers import find_index, peakdet, replace_nan
from params import fall_params
def calc_fall_flush_timings_durations(flow_matrix, summer_timings):
max_zero_allowed_per_year = fal... | 48.59387 | 350 | 0.653552 | [
"MIT"
] | NoellePatterson/func-flow-plot | utils/calc_fall_flush.py | 12,683 | Python |
from prometheus_client import start_http_server, Gauge, Counter
all_users = Gauge('users_in_all_guilds', 'All users the bot is able to see.')
all_guilds = Gauge('guilds_bot_is_in', 'The amount of guilds the bot is in.')
ready_events = Counter('ready_events', 'Amount of READY events recieved during uptime.')
message_e... | 45.333333 | 92 | 0.775735 | [
"MIT"
] | trilleplay/kanelbulle | bot/utils/prometheus_tools.py | 544 | Python |
"""projeto URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | 33.72 | 79 | 0.698695 | [
"MIT"
] | godah/s2b-python | projeto/urls.py | 843 | Python |
# -*- coding: utf-8 -*-
import logging
from ocp_resources.constants import PROTOCOL_ERROR_EXCEPTION_DICT
from ocp_resources.resource import TIMEOUT, Resource
from ocp_resources.utils import TimeoutSampler
LOGGER = logging.getLogger(__name__)
class CDIConfig(Resource):
"""
CDIConfig object.
"""
ap... | 27.965517 | 87 | 0.646732 | [
"Apache-2.0"
] | amastbau/openshift-python-wrapper | ocp_resources/cdi_config.py | 1,622 | Python |
"""Database schemas, examples, and tools"""
import copy
from warnings import warn
from cerberus import Validator
from .sorters import POSITION_LEVELS
SORTED_POSITION = sorted(POSITION_LEVELS.keys(), key=POSITION_LEVELS.get)
ACTIVITIES_TYPE = ["teaching", "research"]
AGENCIES = ["nsf", "doe"]
APPOINTMENTS_TYPE = ["g... | 39.058422 | 145 | 0.424287 | [
"CC0-1.0"
] | priyankaanehra/regolith | regolith/schemas.py | 165,807 | Python |
from .services import * # noqa
| 16 | 31 | 0.6875 | [
"BSD-3-Clause"
] | sot/mica | mica/archive/cda/__init__.py | 32 | Python |
import pysftp
import os.path
def upload_sprog_to_namecheap(tmpdir, passwords):
with pysftp.Connection(passwords["NAMECHEAP_SERVER"], username=passwords["NAMECHEAP_USERNAME"],
password=passwords["NAMECHEAP_PASSWORD"], port=passwords["NAMECHEAP_PORT"]) as sftp:
with sftp.cd('publi... | 45.8 | 111 | 0.611354 | [
"MIT",
"BSD-3-Clause"
] | PaulKlinger/Sprog-Backend | sprog/namecheap_ftp_upload.py | 1,145 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from handlers.Home_Core import Home_Core
class ITM_Core(Home_Core):
def __init__(self, request, response, itm_db):
super(ITM_Core, self).__init__(request, response)
self.itmDB = itm_db
self.db = itm_db.db
| 23.636364 | 51 | 0.723077 | [
"BSD-3-Clause"
] | Jai-Chaudhary/termite-data-server | server_src/modules/handlers/ITM_Core.py | 260 | Python |
from typing import Dict, List, TypeVar, Generic
import warnings
import torch
import numpy
from allennlp.common import Registrable
from allennlp.data.tokenizers.token import Token
from allennlp.data.vocabulary import Vocabulary
TokenType = TypeVar("TokenType", int, List[int], numpy.ndarray)
class TokenIndexer(Gener... | 44.234899 | 104 | 0.678046 | [
"Apache-2.0"
] | loopylangur/allennlp | allennlp/data/token_indexers/token_indexer.py | 6,591 | Python |
from pyowm import OWM
owm = OWM('21ff51d901692fd3e2f5ecc04d3617f1')
place = input('Input Place: ')
mgr = owm.weather_manager()
observation = mgr.weather_at_place(place)
w = observation.weather
wind = w.detailed_status
t = w.temperature('celsius')
print(wind)
print(t)
exit_ = input('')
| 24.75 | 46 | 0.727273 | [
"MIT"
] | Geimers228/PyDev | weather.py | 297 | Python |
from __future__ import print_function
import os
import datetime
import sqlalchemy as sa
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.hybrid import hybrid_method
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import Query, scoped... | 28.272311 | 88 | 0.671712 | [
"MIT"
] | AdamGold/sqlalchemy-mixins | examples/smartquery.py | 12,355 | Python |
#! /usr/bin/env python
import rospy
from std_msgs.msg import Int32
def cb(message):
rospy.loginfo(message.data*2)
print (rospy.loginfo)
if message.data%2 == 0:
print ('0')
elif message.data%2 != 0 :
print('1')
if __name__ == '__main__':
rospy.init_node('twice')
sub = rospy... | 18.6 | 49 | 0.612903 | [
"BSD-3-Clause"
] | note032/ROS_robosys | mypkg/scripts/twice.py | 372 | Python |
import json
from typing import List, Dict
from icecream import ic
from compiler_idioms.idiom.instruction_sequence import InstructionSequence
from compiler_idioms.idiom.utils.magic import compute_magic_numbers_if_not_exists
from compiler_idioms.instruction import from_anonymized_pattern, Instruction
from compiler_idio... | 40.545455 | 131 | 0.67713 | [
"MIT"
] | fkie-cad/pidarci | compiler_idioms/idiom/implementations/remainder_signed_todo.py | 2,676 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2015, IBM Corp.
# All rights reserved.
#
# Distributed under the terms of the BSD Simplified License.
#
# The full license is in the LICENSE file, distributed with this software.
... | 34.152074 | 106 | 0.643773 | [
"BSD-3-Clause"
] | alexmid/ibmdbpy | ibmdbpy/tests/test_frame.py | 14,822 | Python |
#!/usr/bin/env python
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import datetime
import json
import logging
import os
import re
import StringIO
import sys
import tempfile
import threading
i... | 31.401368 | 80 | 0.526184 | [
"BSD-3-Clause"
] | FLOSSBoxIN/src | tools/swarming_client/tests/swarming_test.py | 59,694 | Python |
#!/usr/bin/env python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""
Script to generate gperf tables of kernel object metadata
User mode threads making system calls reference kernel objects by memory
address, as the kernel/driver APIs in Zephyr are the same for both user
and supe... | 31.736634 | 116 | 0.613621 | [
"Apache-2.0"
] | TTJO/zephyr | scripts/gen_kobject_list.py | 32,054 | Python |
# 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 applica... | 35.928058 | 80 | 0.718662 | [
"Apache-2.0"
] | tensorflow/tpu-demos | models/official/unet3d/unet_main.py | 4,994 | Python |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import numpy... | 45.987847 | 169 | 0.625363 | [
"MIT"
] | NCTUMLlab/Adversarial-Masking-Transformers-for-Language-Understanding | models/transformer.py | 105,956 | Python |
# Copyright 2017 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 ag... | 35.5 | 78 | 0.697183 | [
"Apache-2.0"
] | aliabd/history-of-interpretation | saliency/guided_backprop.py | 2,982 | Python |
import jax.numpy as jnp
import jax.random as random
import numpyro
import numpyro.distributions as dist
from numpyro.infer import MCMC, NUTS
from typing import Any, Dict, Optional
class PlayerModel(object):
"""
numpyro implementation of the AIrsenal player model.
"""
def __init__(self):
self... | 33.227723 | 88 | 0.554827 | [
"MIT"
] | JPKFin/AIrsenal | airsenal/framework/player_model.py | 3,356 | Python |
from .plot import plot
from .simple_plot import simple_plot
| 20 | 36 | 0.833333 | [
"BSD-3-Clause"
] | ebolyen/q2-gamma | q2_gamma/visualizers/__init__.py | 60 | Python |
# -*- coding: utf-8 -*-
""" OneLogin_Saml2_Settings class
Copyright (c) 2010-2018 OneLogin, Inc.
MIT License
Setting class of OneLogin's Python Toolkit.
"""
from time import time
import re
from os.path import dirname, exists, join, sep
from app.utils.onelogin.saml2 import compat
from app.utils.onelogin.saml2.const... | 36.322055 | 153 | 0.583198 | [
"MIT"
] | nycrecords/intranet | app/utils/onelogin/saml2/settings.py | 28,985 | Python |
from emonitor.utils import Module
from emonitor.extensions import babel
from .content_frontend import getFrontendContent, getFrontendData
class LocationsModule(Module):
info = dict(area=['frontend'], name='locations', path='locations', icon='fa-code-fork', version='0.1')
def __repr__(self):
return "l... | 29.142857 | 118 | 0.693627 | [
"BSD-3-Clause"
] | Durburz/eMonitor | emonitor/modules/locations/__init__.py | 816 | Python |
import functools
import os
import random
import matplotlib.pyplot as plt
import networkx as nx
def make_graph(path):
G = nx.DiGraph()
with open(path, 'r') as f:
lines = f.readlines()
# random.seed(0)
sample_nums = int(len(lines) * 0.00006)
lines = random.sample(lines, sample_... | 31.066914 | 105 | 0.551514 | [
"MIT"
] | showerhhh/ComplexNetwork | homework_3/main.py | 8,559 | Python |
from nlu import *
from nlu.pipe_components import SparkNLUComponent
from sparknlp.annotator import *
class Lemmatizer(SparkNLUComponent):
def __init__(self,component_name='lemma', language='en', component_type='lemmatizer', get_default=False,model = None, sparknlp_reference=''):
component_name = 'lemmatiz... | 44.888889 | 145 | 0.709158 | [
"Apache-2.0"
] | sumanthratna/nlu | nlu/components/lemmatizer.py | 808 | Python |
import base64
import os
import tkinter as tk
import tkinter.messagebox as msg
import tkinter.ttk as ttk
from functools import partial
from chatwindow import ChatWindow
from requester import Requester
from avatarwindow import AvatarWindow
from addfriendwindow import AddFriendWindow
friend_avatars_dir = os.path.abspat... | 35.891192 | 151 | 0.651653 | [
"MIT"
] | PacktPublishing/Tkinter-GUI-Programming-by-Example | Chapter10/Ch10/friendslist.py | 6,927 | Python |
#!/usr/bin/env python
"""
Solution to Project Euler Problem
http://projecteuler.net/
by Apalala <apalala@gmail.com>
(cc) Attribution-ShareAlike
http://creativecommons.org/licenses/by-sa/3.0/
We shall say that an n-digit number is pandigital if it makes use of all
the digits 1 to n exactly once. For example, 2143 is ... | 22.391304 | 73 | 0.707767 | [
"MIT"
] | Web-Dev-Collaborative/PYTHON_PRAC | projecteuler/euler041_pandigital_prime.py | 1,030 | Python |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Zyxel.ZyNOS.get_inventory
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ------------------------------------------------------... | 39.87218 | 100 | 0.456723 | [
"BSD-3-Clause"
] | ewwwcha/noc | sa/profiles/Zyxel/ZyNOS/get_inventory.py | 5,303 | Python |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyHqcLegacy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ------... | 34.131579 | 84 | 0.58751 | [
"BSD-3-Clause"
] | Qcircuits/exopy_hqc_legacy | tests/tasks/tasks/instr/test_apply_mag_field_task.py | 3,891 | Python |
from asyncio import sleep
from discord import FFmpegPCMAudio, PCMVolumeTransformer
from configs import bot_enum
from ..session.Session import Session
async def alert(session: Session):
vc = session.ctx.voice_client
if not vc:
return
path = bot_enum.AlertPath.POMO_END
if session.state == bot... | 29.321429 | 85 | 0.678441 | [
"MIT"
] | SlenderCylinder/pomoji | bot/src/utils/player.py | 821 | Python |
#!/usr/bin/env python
# $Id$
#
# Author: Thilee Subramaniam
#
# Copyright 2012 Quantcast Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 37.170588 | 115 | 0.627947 | [
"Apache-2.0"
] | chanwit/qfs | benchmarks/mstress/mstress_plan.py | 6,319 | Python |
"""
Support for Syslog-based networking devices.
For now, support is limited to hostapd and dnsmasq.
Example syslog lines:
<30>Dec 31 13:03:21 router hostapd: wlan1: STA a4:77:33:e3:17:7c WPA: group key handshake completed (RSN)
<29>Dec 31 13:05:15 router hostapd: wlan0: AP-STA-CONNECTED 64:20:0c:37:52:82
... | 35.089005 | 137 | 0.609669 | [
"MIT"
] | Bun/ha-syslog-devtracker | syslog.py | 6,702 | Python |
import xlrd
import os
import sys
import copy
import json
import codecs
from collections import OrderedDict
# Constant Values
PARENT_NAME_ROW = 0
PARENT_NAME_COL = 0
COLUMN_NAMES_ROW = 1
DATA_STARTING_ROW = 2
ROOT_NAME = '*root'
ID_COLUMN_NAME = 'id'
PARENT_COLUMN_NAME = '*parent'
IGNORE_WILDCARD = '_'
REQUIRE_VERSION ... | 30.017094 | 117 | 0.589408 | [
"CC0-1.0"
] | mousedoc/Prism | third-party/language/generator.py | 7,024 | Python |
import torch.nn as nn
import torch.nn.functional as F
import torch
from mmcv.cnn import ConvModule
from mmcv.runner import force_fp32
from mmdet.models.builder import HEADS, build_loss
from mmdet.models.losses import accuracy
from .bbox_head import BBoxHead
from mmdet.core import multi_apply, multiclass_nms
from mmd... | 45.200603 | 154 | 0.521523 | [
"Apache-2.0"
] | marcovalenti/mmdetection | mmdet/models/roi_heads/bbox_heads/convfc_bbox_head.py | 29,968 | Python |
#! /usr/bin/env python3
""" example module: extra.good.best.tau """
def FunT():
return "Tau"
if __name__ == "__main__":
print("I prefer to be a module") | 17.444444 | 43 | 0.649682 | [
"MIT"
] | tomasfriz/Curso-de-Cisco | Curso de Cisco/Actividades/py/packages/extra/good/best/tau.py | 157 | Python |
#!/usr/bin/env python3
import os
import requests
os.system("clear")
print("""
██ ██ █████ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ █ ██ ███████ ██ ██ ██ ██ ███
██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██
███ ███ ██ ██ ███████ ███████... | 40.086957 | 143 | 0.588124 | [
"MIT"
] | Manoj-Paramsetti/Wallux | wallux.py | 3,930 | Python |
# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
from decisionengine.framework.modules.Publisher import Publisher
def test_publisher_structure():
"""
The module.publisher itself is a bit of a skeleton...
"""
params = {"1": 1, "2": 2, "channel_name": "t... | 31.909091 | 86 | 0.706553 | [
"Apache-2.0"
] | BrunoCoimbra/decisionengine | src/decisionengine/framework/modules/tests/test_Publisher.py | 702 | Python |
# 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 applica... | 39.84492 | 82 | 0.668232 | [
"Apache-2.0"
] | Ezra-H/autodist | examples/benchmark/utils/recommendation/ncf_input_pipeline.py | 7,451 | Python |
# coding=utf-8
"""
A utility module for working with playbooks in the `origin-ci-tool` repository.
"""
from __future__ import absolute_import, division, print_function
from os.path import abspath, dirname, exists, join
from click import ClickException
def playbook_path(playbook_name):
"""
Get the path to th... | 29.666667 | 118 | 0.707865 | [
"Apache-2.0"
] | DennisPeriquet/origin-ci-tool | oct/util/playbook.py | 1,068 | Python |
import os
import json
CONFIG_FILE_PATH = os.path.expanduser("~/.coinbase-indicator")
GENERAL_OPTION_KEY = 'general'
OPTION_KEY_LARGE_LABEL = 'show_crypto_currency_in_the_label'
OPTION_KEY_NOTIFICATION = 'show_notifications'
OPTION_KEY_THEME_MONOCHROME = 'theme_monochrome'
CRYPTO_CURRENCY_OPTION_KEY = 'crypto_currenc... | 39.415929 | 186 | 0.705658 | [
"Apache-2.0"
] | amitkumarj441/Cryptocoin-Price-Indicator | indicator/config.py | 4,454 | Python |
# pylint: disable=redefined-outer-name
import pytest
from dagster.core.code_pointer import ModuleCodePointer
from dagster.core.definitions.reconstructable import ReconstructableRepository
from dagster.core.host_representation.grpc_server_registry import ProcessGrpcServerRegistry
from dagster.core.host_representation.h... | 28.32 | 100 | 0.655932 | [
"Apache-2.0"
] | PenguinToast/dagster | python_modules/dagster/dagster_tests/daemon_tests/test_queued_run_coordinator_daemon.py | 10,620 | Python |
# -*- coding: utf-8 -*-
import tensorflow as tf
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
import argparse
from aquaman_net import AquamanNet
from utils import IMAGE_SIZE
EPOCHS = 1000
BATCH_SIZE = 4
def preproc(image_bytes):
image_jpg = tf.image.d... | 32.63964 | 109 | 0.637593 | [
"MIT"
] | brungcm/health-hack-2019 | ml/train_net.py | 7,246 | Python |
#!/usr/bin/env python
"""
Test Service
"""
from ..debugging import bacpypes_debugging, ModuleLogger
# some debugging
_debug = 0
_log = ModuleLogger(globals())
def some_function(*args):
if _debug: some_function._debug("f %r", args)
return args[0] + 1
bacpypes_debugging(some_function) | 16.5 | 56 | 0.720539 | [
"MIT"
] | ChristianTremblay/bacpypes | py25/bacpypes/service/test.py | 297 | Python |
# Copyright 2021 The Couler 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 applicable law or... | 35.506173 | 78 | 0.585883 | [
"Apache-2.0"
] | javoweb/couler | couler/core/step_update_utils.py | 8,628 | Python |
""" Pymode utils. """
import os.path
import sys
import threading
import warnings
from contextlib import contextmanager
import vim # noqa
from ._compat import StringIO, PY2
DEBUG = int(vim.eval('g:pymode_debug'))
warnings.filterwarnings('ignore')
@contextmanager
def silence_stderr():
""" Redirect stderr. """
... | 20 | 76 | 0.630952 | [
"MIT"
] | Jenkin0603/myvim | bundle/python-mode/pymode/utils.py | 840 | Python |
import graphene
import graphql_jwt
from graphql_jwt.refresh_token.mixins import RefreshTokenMixin
from ..testcases import SchemaTestCase
from . import mixins
class TokenAuthTests(mixins.TokenAuthMixin, SchemaTestCase):
query = '''
mutation TokenAuth($username: String!, $password: String!) {
tokenAuth(... | 22.945455 | 64 | 0.674326 | [
"MIT"
] | CZZLEGEND/django-graphql-jwt | tests/refresh_token/test_mutations.py | 1,262 | Python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import glob
import os.path
import sys
DIR = os.path.dirname(os.path.abspath(__file__))
REPO = os.path.dirname(os.path.dirname(DIR))
SRC_DIR = os.path.join(REPO, "src")
def check_header_files(component):
component_dir = os.path... | 28.979167 | 90 | 0.591661 | [
"MIT"
] | karthikv792/PlanningAssistance | planner/FAST-DOWNWARD/misc/style/check-include-guard-convention.py | 1,391 | Python |
# Copyright (C) 2017-2019 New York University,
# University at Buffalo,
# Illinois Institute of Technology.
#
# 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 th... | 32.943182 | 79 | 0.588134 | [
"ECL-2.0",
"Apache-2.0"
] | VizierDB/web-api-async | vizier/api/client/cli/command.py | 2,899 | Python |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.water_heaters_and_thermal_storage import WaterHeaterMixed
log = logging.getLogger(__name__)
class TestWaterHeaterMixed(unittest.TestCase):
def setUp(self):
self.fd,... | 61.848485 | 164 | 0.787686 | [
"Apache-2.0"
] | marcelosalles/pyidf | tests/test_waterheatermixed.py | 12,246 | Python |
# coding=UTF-8
import os
import re
import sys
class BaseStringScript:
# State
STATE_SEARCHING='STATE_SEARCHING'
STATE_IN_STR='STATE_IN_STR'
STATE_IN_PLUR='STATE_IN_PLUR'
# Tag types
TYPE_STR='TYPE_STR'
TYPE_PLUR='TYPE_PLUR'
# String tag start/end
START_STR = '<string'
END_STR = '</string'
# ... | 24.72449 | 66 | 0.626083 | [
"Apache-2.0"
] | 1y445rc/FirebaseUI-Android | scripts/translations/base_string_script.py | 2,423 | Python |
from cloudify import ctx
from cloudify.state import ctx_parameters as inputs
from cloudify.decorators import operation
from cloudify.exceptions import *
from plugin.nodes.utils import *
def build_radl_flavour(config):
ctx.logger.debug('{0} Infrastructure Manager deployment info:'.format(get_log_indentation()))
... | 39.444444 | 97 | 0.697887 | [
"Apache-2.0"
] | MSO4SC/cloudify-im-extension | plugin/nodes/flavour.py | 1,420 | Python |
"""Certbot client."""
# version number like 1.2.3a0, must have at least 2 parts, like 1.2
__version__ = '1.14.0.dev0'
| 29.5 | 67 | 0.686441 | [
"Apache-2.0"
] | 4n3i5v74/certbot | certbot/certbot/__init__.py | 118 | Python |
import subprocess
import py
import pytest
@pytest.fixture(
params=["tests/dataset-rdstmc", "tests/dataset-wiki", "tests/dataset-rntutor"]
)
def datasetdir(request):
return py.path.local(request.param)
@pytest.fixture
def messages(datasetdir):
msgdir = datasetdir.join("messages")
return msgdir.listd... | 23.93 | 82 | 0.695779 | [
"MIT"
] | eugenehp/jingtrang | tests/test_it.py | 2,393 | Python |
"""Config flow to configure the Netgear integration."""
from __future__ import annotations
import logging
from typing import cast
from urllib.parse import urlparse
from pynetgear import DEFAULT_HOST, DEFAULT_PORT, DEFAULT_USER
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.compo... | 32.00463 | 88 | 0.645885 | [
"Apache-2.0"
] | 2004happy/core | homeassistant/components/netgear/config_flow.py | 6,913 | Python |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV 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
#
# THIS SOFTWARE IS PR... | 37.641791 | 96 | 0.652458 | [
"Apache-2.0"
] | Wlgen/force-riscv | tests/riscv/vector/vector_simple_add_force.py | 5,044 | Python |
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget
class JogWidget(QWidget):
def __init__(self, parent, callback):
super(JogWidget, self).__init__(parent)
self.parent = parent
self.callback = callback
self.wx_current = 0
self.wy_current = 0
... | 30.622642 | 89 | 0.585952 | [
"MIT"
] | comgram/gerbil_gui | classes/jogwidget.py | 1,623 | Python |
from collections import namedtuple
import logging
import random
from Items import ItemFactory
#This file sets the item pools for various modes. Timed modes and triforce hunt are enforced first, and then extra items are specified per mode to fill in the remaining space.
#Some basic items that various modes requ... | 45.354497 | 477 | 0.615726 | [
"MIT"
] | mzxrules/MM-Randomizer | ItemList.py | 8,572 | Python |
# Generated by Django 3.1 on 2020-08-08 11:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('socialpages', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='tags',
fields=[
('id', m... | 25.12 | 114 | 0.555732 | [
"MIT"
] | OjureFred/SocialGram | socialpages/migrations/0002_auto_20200808_1457.py | 628 | Python |
from __future__ import unicode_literals
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from redis_metrics.utils import generate_test_metrics
class Command(BaseCommand):
args = '<metric-name> [<metric-name> ...]'
help = "Creates Lots of Dummy Metrics"
opt... | 31.096774 | 79 | 0.544606 | [
"MIT"
] | bradmontgomery/django-redis-metrics | redis_metrics/management/commands/generate_test_metrics.py | 1,928 | Python |
from pathlib import Path
from datetime import datetime
import fire
import torch
import torch.nn as nn
import torch.optim as optim
import ignite
import ignite.distributed as idist
from ignite.engine import Events, Engine, create_supervised_evaluator
from ignite.metrics import Accuracy, Loss
from ignite.handlers impor... | 35.907303 | 120 | 0.662833 | [
"BSD-3-Clause"
] | HelioStrike/ignite | examples/contrib/cifar10/main.py | 12,783 | Python |
"""
Required device info for the PIC16F1768 devices
"""
from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect
DEVICE_INFO = {
'name': 'pic16f1768',
'architecture': 'PIC16',
# Will erase Flash, User ID and Config words
'default_bulk_erase_address_word': 0x8000,
# Flash
'flash_address_word... | 30.2 | 67 | 0.725993 | [
"MIT"
] | KrystianD-contribution/pymcuprog | pymcuprog/deviceinfo/devices/pic16f1768.py | 1,208 | Python |
__copyright__ = """
Copyright (C) 2020 University of Illinois Board of Trustees
"""
__license__ = """
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 limitat... | 29.278388 | 79 | 0.671337 | [
"MIT"
] | anderson2981/mirgecom | test/test_init.py | 7,993 | Python |
import asyncio
from aiohttp import web
from tt_web import log
from tt_web import postgresql
async def initialize(config, loop):
await postgresql.initialize(config['database'], loop=loop)
async def deinitialize(config, loop):
await postgresql.deinitialize()
async def on_startup(app):
await initializ... | 22.522388 | 80 | 0.726972 | [
"BSD-3-Clause"
] | devapromix/the-tale | src/tt_bank/tt_bank/service.py | 1,509 | Python |
import pickle
import fcntl
import os
import struct
from collections import defaultdict
from functools import partial
from asyncio import new_event_loop
from io import BytesIO
from .utils import opposite_dict
MESSAGE_LENGTH_FMT = 'I'
def set_nonblocking(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
... | 32.239583 | 114 | 0.636187 | [
"MIT"
] | kmaork/madbg | madbg/communication.py | 3,095 | Python |
import logging
import sys
import time
from rdflib.graph import Graph
from hexastore import turtle
from hexastore.memory import InMemoryHexastore
logger = logging.getLogger(__name__)
root = logging.getLogger()
root.setLevel(logging.DEBUG)
class Timer:
def __enter__(self):
self.start = time.perf_counte... | 25.421053 | 93 | 0.668737 | [
"MIT"
] | alexchamberlain/mutant | benchmarks/bnb.py | 1,449 | Python |
"""
Host management app
"""
from django.urls import path
from .views import *
app_name = 'sys_inspect'
urlpatterns = [
# 设备列表
path('device/list', InspectDevInfoViews.as_view(), name='inspect_devices_list'),
# 添加设备
path('device/add', AddDevView.as_view(), name='inspect_devices_add'),
# 删除设备
... | 22.114286 | 85 | 0.686047 | [
"MIT"
] | MaLei666/oms | apps/sys_inspect/urls.py | 830 | Python |
# -*- coding: utf-8 -*-
import itertools
import logging
import numpy as np
from collections import OrderedDict
from collections.abc import Mapping
from typing import Dict, List, Optional, Tuple, Union
import torch
from omegaconf import DictConfig, OmegaConf
from torch import Tensor, nn
from detectron2.layers import S... | 39.900369 | 100 | 0.620827 | [
"Apache-2.0"
] | KnightOfTheMoonlight/visdom4detectron2 | detectron2/modeling/mmdet_wrapper.py | 10,813 | Python |
"""
@Author: Rossi
Created At: 2021-02-21
"""
import json
import time
from mako.template import Template
from Broca.faq_engine.index import ESIndex, VectorIndex
from Broca.message import BotMessage
class FAQAgent:
def __init__(self, agent_name, es_index, vector_index, threshold, topk, prompt_threshold,
... | 39.684932 | 132 | 0.669313 | [
"MIT"
] | lawRossi/Broca | Broca/faq_engine/agent.py | 2,897 | Python |
# -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | 31.126984 | 110 | 0.500765 | [
"BSD-3-Clause"
] | megcunningham/django-diesel | config/settings/local.py | 1,961 | Python |
import argparse
import torch.optim as optim
import sys
from utils import *
from data import data_generator
import time
import math
from setproctitle import setproctitle
import warnings
sys.path.append("../")
from model import TrellisNetModel
warnings.filterwarnings("ignore") # Suppress the RunTimeWarning on unicode... | 39.111717 | 109 | 0.585063 | [
"MIT"
] | CookieBox26/trellisnet | char_PTB/char_ptb.py | 14,354 | Python |
import copy
import sys
from abc import ABC, abstractmethod
from enum import Enum
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Tuple, Union
import yaml
from ._utils import (
_DEFAULT_MARKER_,
ValueKind,
_ensure_container,
_get_value,
_is_interpolation,
_is_missing_lite... | 36.87931 | 103 | 0.569331 | [
"BSD-3-Clause"
] | gwenzek/omegaconf | omegaconf/basecontainer.py | 32,085 | Python |
# Copyright 2019-2019 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 41.866667 | 98 | 0.512966 | [
"Apache-2.0"
] | QPC-database/amazon-braket-schemas-python | src/braket/device_schema/dwave/dwave_device_capabilities_v1.py | 4,396 | Python |
import unittest
from programy.bot import Bot
from programy.config.bot.bot import BotConfiguration
from programy.sentiment.extension import SentimentExtension
from programytest.client import TestClient
class SentimentExtensionTests(unittest.TestCase):
def setUp(self):
self._client = TestClient()
... | 39.25974 | 112 | 0.726431 | [
"MIT"
] | motazsaad/fit-bot-fb-clt | test/programytest/sentiment/test_extension.py | 3,023 | Python |
from pathlib import Path
from subprocess import PIPE, CalledProcessError
from typing import Iterable, List, Tuple, Union
import matplotlib.pyplot as plt
PathLike = Union[Path, str]
conf_opening, conf_closing = "+++++", "-----"
def profile_config_file(
binary_path: PathLike,
config_path: PathLike,
output... | 36.170507 | 98 | 0.673844 | [
"Apache-2.0"
] | vzyrianov/hpvm-autograd | hpvm/projects/hpvm-profiler/hpvm_profiler/__init__.py | 7,849 | Python |
# pylint: disable=too-many-lines
import os
import random
import shutil
import time
import uuid
from retval import RetVal
from pycryptostring import CryptoString
from pymensago.encryption import EncryptionPair
from pymensago.hash import blake2hash
from pymensago.serverconn import ServerConnection
from integration_set... | 29.59148 | 99 | 0.693192 | [
"MIT"
] | mensago/mensagod | tests/integration/test_fscmds.py | 42,375 | Python |
# Copyright 2017 Battelle Energy Alliance, 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 t... | 37.821782 | 132 | 0.620942 | [
"Apache-2.0"
] | alptezbasaran/raven | framework/SupervisedLearning/pickledROM.py | 3,820 | Python |
#******************************************************************************
# Copyright (C) 2013 Kenneth L. Ho
#
# 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 t... | 31.931343 | 92 | 0.628743 | [
"BSD-3-Clause"
] | AtsushiSakai/scipy | scipy/linalg/interpolative.py | 32,091 | Python |
#!/usr/bin/python
#
# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | 36.099723 | 319 | 0.518339 | [
"MIT"
] | audevbot/autorest.cli.debug | generated/ansible-collection/subscriptionssubscriptionfactory.py | 13,032 | Python |
from __future__ import print_function
import gevent
import gevent.core
import os
import time
filename = 'tmp.test__core_stat.%s' % os.getpid()
hub = gevent.get_hub()
DELAY = 0.5
EV_USE_INOTIFY = getattr(gevent.core, 'EV_USE_INOTIFY', None)
try:
open(filename, 'wb', buffering=0).close()
assert os.path.exis... | 31.691176 | 96 | 0.664501 | [
"MIT"
] | pubnub/gevent | greentest/test__core_stat.py | 2,155 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
from django.urls import include, url
except ImportError:
from django.conf.urls import include, url # noqa: F401
| 19.3 | 59 | 0.715026 | [
"MIT"
] | Nikolina2112/django-rest-framework-jwt | src/rest_framework_jwt/compat.py | 193 | Python |
#!/usr/bin/env python
import urllib,urllib2
import json
import csv
import time
from datetime import date, timedelta
class Admin:
'''A class of tools for administering AGO Orgs or Portals'''
def __init__(self, username, portal=None, password=None):
from . import User
self.user = User(username,... | 41.250636 | 547 | 0.559603 | [
"Apache-2.0"
] | SpatialStrout/ago-tools | admin.py | 32,423 | Python |
import re
from typing import TypeVar
import questionary
EnumType = TypeVar("EnumType")
# 驼峰命名转蛇形命名
def camel_to_snake(text: str) -> str:
return re.sub(r"(?<!^)(?=[A-Z])", "_", text).lower()
# 蛇形命名转驼峰命名
def snake_to_camel(text: str) -> str:
return text.split('_')[0] + "".join(x.title() for x in text.split('... | 28 | 94 | 0.691558 | [
"MIT"
] | fmw666/fastapi-builder | fastapi_builder/helpers.py | 980 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 47.744 | 1,682 | 0.680379 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/python/pulumi_azure_native/network/v20201101/network_virtual_appliance.py | 23,872 | Python |
"""Integration tests for Glesys"""
from unittest import TestCase
import pytest
from lexicon.tests.providers.integration_tests import IntegrationTestsV1
# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *each and every* implementation of the interface must
# pass, by inheritanc... | 34.583333 | 91 | 0.774699 | [
"MIT"
] | HelixEducation/lexicon | lexicon/tests/providers/test_glesys.py | 830 | Python |
from datetime import timedelta
from random import randint
from ichnaea.data.tasks import (
monitor_api_key_limits,
monitor_api_users,
monitor_queue_size,
)
from ichnaea import util
class TestMonitor(object):
def test_monitor_api_keys_empty(self, celery, stats):
monitor_api_key_limits.delay()... | 36.223077 | 79 | 0.561478 | [
"Apache-2.0"
] | BBOXX/ichnaea | ichnaea/data/tests/test_monitor.py | 4,709 | Python |
"""
# =============================================================================
# Creates the stiffness matrix as requested, using the material properties
# provided in the TPD file (for v2020 files).
#
# Author: William Hunter, Tarcísio L. de Oliveira
# Copyright (C) 2008, 2015, William Hunter.
# Copyright (C) 2... | 32.733333 | 79 | 0.479837 | [
"MIT"
] | TarcLO/topy | topy/data/H8T_K.py | 2,459 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.