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 |
|---|---|---|---|---|---|---|---|---|
"""Test UniFi config flow."""
from unittest.mock import patch
import aiounifi
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.unifi.const import (
CONF_ALLOW_BANDWIDTH_SENSORS,
CONF_ALLOW_UPTIME_SENSORS,
CONF_BLOCK_CLIENT,
CONF_CONTROLLER,
CONF_DETECT... | 31.936455 | 88 | 0.60221 | [
"Apache-2.0"
] | Nixon506E/home-assistant | tests/components/unifi/test_config_flow.py | 19,098 | Python |
import math
import random
import time
import argparse
from sklearn import preprocessing
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, precision_score, recall_score, roc_curve, auc
import pandas as pd
import numpy as np
import torch.nn as nn
import torch
from LR import... | 35.402062 | 122 | 0.631722 | [
"MIT"
] | ZZR0/ISSTA21-JIT-DP | JIT_Baseline/baseline.py | 10,342 | Python |
"""
Support the sensor of a BloomSky weather station.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/sensor.bloomsky/
"""
import logging
from homeassistant.const import TEMP_FAHRENHEIT
from homeassistant.helpers.entity import Entity
from homeassistant.... | 31.663043 | 79 | 0.625472 | [
"MIT"
] | 1lann/home-assistant | homeassistant/components/sensor/bloomsky.py | 2,914 | Python |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | 55.504854 | 128 | 0.682526 | [
"Apache-2.0"
] | 1810824959/kafka | tests/kafkatest/tests/client/message_format_change_test.py | 5,717 | Python |
# -*- coding: utf-8 -*-
"""
[googleSearch.py]
Google Search Plugin
[Author]
Justin Walker
[About]
Returns the first three links from a google search.
[Commands]
>>> .google <<search term>>
returns search links
"""
try:
from googlesearch import search
except ImportError:
print("No modu... | 28.7 | 92 | 0.524739 | [
"MIT"
] | IronPenguin4179/honeybot | honeybot/plugins/google.py | 1,435 | 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... | 38.059524 | 103 | 0.714983 | [
"Apache-2.0"
] | 121Y/examples | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | 15,985 | Python |
def get_the_ith_largest(s1: list, s2: list, i: int):
m = len(s1)
n = len(s2)
if i > m + n:
raise IndexError('list index out of range')
i -= 1
l1 = 0
r1 = i if m - 1 >= i else m - 1
while l1 <= r1:
c1 = (l1 + r1) // 2
c1_f = i - c1 - 1
c1_b = i - c1
i... | 25.586207 | 65 | 0.467655 | [
"MIT"
] | keybrl/xdu-coursework | projects/g3h2-algorithm/practice1/4.py | 742 | Python |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""
spyderlib.widgets
=================
Widgets defined in this module may be used in any other Qt-based application
They are also used in Spyder throug... | 23.375 | 77 | 0.679144 | [
"MIT"
] | MarlaJahari/Marve | spyderlib/widgets/__init__.py | 375 | Python |
from math import ceil
from time import sleep
from config import *
from servo import *
from camera import *
from pid import *
# Init
servo1 = Servo(2)
servo2 = Servo(3)
servo_count = 0
#servo1.setAngle(90)
#sleep(1)
#servo2.setAngle(90)
#sleep(1)
camera = Camera()
PID = PID()
# Loop
while True:
data = ca... | 17.72619 | 137 | 0.534587 | [
"MIT"
] | alvarlagerlof/ball-pid | run.py | 1,489 | Python |
# -*- coding: utf-8 -*-
# @Author: Jie
# @Date: 2017-06-15 14:11:08
# @Last Modified by: Jie Yang, Contact: jieynlp@gmail.com
# @Last Modified time: 2019-02-13 12:41:44
from __future__ import print_function
import time
import sys
import argparse
import random
import torch
import gc
import torch.nn as nn
import... | 44.199554 | 219 | 0.645749 | [
"Apache-2.0"
] | DeniseMak/ner-neuron | main.py | 39,647 | Python |
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as go
from pymongo import MongoClient
import json
import os
client = MongoClient(os.environ.get("DATABASE"))
db = client.politics.brexit
external_stylesheets = ['https://codepen.io/chriddy... | 24.432099 | 96 | 0.547246 | [
"MIT"
] | brittwitham/brexit-word-freq | brexit-word-freq/app.py | 1,979 | Python |
import pytest
from nbformat import notebooknode
from nb2hugo.preprocessors import FixLatexPreprocessor
@pytest.fixture
def preprocessor():
"""Return an instance of FixLatexPreprocessor."""
return FixLatexPreprocessor()
source = (
'Some text with an inline equality $escaped\_0 = lower_0$.\n'
'And a d... | 30.940299 | 88 | 0.630005 | [
"MIT"
] | IMTorgDemo/hugo-nb2hugo | tests/preprocessors/test_fixlatex.py | 2,073 | Python |
"""WARNING: This code is not recommanded. It is not finished, it is
slower then the version in sandbox/neighbours.py, and it do not work
on the GPU.
We only keep this version here as it is a little bit more generic, so
it cover more cases. But thoses cases aren't needed frequently, so you
probably don't want to use th... | 40.869403 | 84 | 0.570711 | [
"BSD-3-Clause"
] | jych/Theano | theano/sandbox/neighbourhoods.py | 10,953 | Python |
# ======🙋🙋🙋实现了 1个函数fn 映射 为1个URL处理函数!!!
import asyncio, os, inspect, logging, functools
from urllib import parse
from aiohttp import web
from apis import APIError
def get(path):
'''
Define decorator @get('/path')
'''
def decorator(func):
@functools.wraps(func)
def wrapper(*args, *... | 36.567251 | 167 | 0.581481 | [
"MIT"
] | qsyPython/Python_play_now | qiushaoyi/programs/qsy_program_codes/python3-webapp/www/coroweb.py | 6,296 | Python |
import uuid
def get_unique_filename(instance, filename):
ext = filename.split('.')[-1]
filename = '{}.{}'.format(uuid.uuid4(), ext)
return 'user_{0}/{1}'.format(instance.author.id, filename)
| 25.625 | 62 | 0.653659 | [
"Apache-2.0"
] | yuramorozov01/courses_system | courses/src/base_app/utils.py | 205 | Python |
import torch.nn as nn
import torch
import torch.nn.functional as F
class CombinationModule(nn.Module):
def __init__(self, c_low, c_up, batch_norm=False, group_norm=False, instance_norm=False):
super(CombinationModule, self).__init__()
if batch_norm:
self.up = nn.Sequential(nn.Conv2d(c_... | 60.025 | 107 | 0.52853 | [
"MIT"
] | yijingru/ObjGuided-Instance-Segmentation | models/layers.py | 2,401 | Python |
# encoding: utf-8
# module Autodesk.Civil.Settings calls itself Settings
# from AeccDbMgd, Version=13.3.854.0, Culture=neutral, PublicKeyToken=null, AeccPressurePipesMgd, Version=13.3.854.0, Culture=neutral, PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class Abbrev... | 32.170963 | 1,533 | 0.679776 | [
"MIT"
] | paoloemilioserra/ironpython-stubs | release/stubs/Autodesk/Civil/Settings.py | 142,260 | Python |
"""
Utilities for training, testing and caching results
for HICO-DET and V-COCO evaluations.
Fred Zhang <frederic.zhang@anu.edu.au>
The Australian National University
Australian Centre for Robotic Vision
"""
import os
import sys
import torch
import random
import warnings
import argparse
import numpy as np
import tor... | 37.875598 | 102 | 0.676983 | [
"BSD-3-Clause"
] | RomeroBarata/upt | main.py | 7,916 | Python |
def assert_rounded_correct_num_decimals(on_offset_arr, decimals):
__tracebackhide__ = True
assert all(
[len(str(float(boundary_s)).split('.')[-1]) <= decimals
for boundary_s in on_offset_arr]
)
| 31.857143 | 65 | 0.681614 | [
"BSD-3-Clause"
] | NickleDave/conbirt | tests/test_formats/test_seq/asserts.py | 223 | Python |
#!/usr/bin/python
import os, sys # low level handling, such as command line stuff
import string # string methods available
import re # regular expressions
import getopt # comand line argument handling
import math # match functions
from low import * # custom functions, written by myself
... | 33.044248 | 154 | 0.497054 | [
"MIT"
] | lotharwissler/bioinformatics | python/fasta/seqlength.py | 3,734 | Python |
# -*- coding: utf-8 -*-
"""
Tests the speed of image updates for an ImageItem and RawImageWidget.
The speed will generally depend on the type of data being shown, whether
it is being scaled and/or converted by lookup table, and whether OpenGL
is used by the view widget
"""
## Add path to library (just for examples; yo... | 32.21 | 214 | 0.651868 | [
"MIT"
] | 3DAlgoLab/pyqtgraph | examples/VideoSpeedTest.py | 9,663 | Python |
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from wagtail.tests.testapp.models import SingleEventPage
from wagtail.tests.testapp.rich_text import C... | 36.90625 | 117 | 0.697835 | [
"BSD-3-Clause"
] | Girbons/wagtail | wagtail/wagtailadmin/tests/test_rich_text.py | 8,267 | Python |
#!/usr/bin/env python
# Copyright (c) 2018, The Regents of the University of California
# 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 cop... | 33.205882 | 79 | 0.692117 | [
"BSD-3-Clause"
] | CogRob/TritonBot | cogrob_ros/cogrob_pololu_lidar/scripts/cogrob_pololu_lidar.py | 5,645 | Python |
"""
The main purpose of this module is to expose LinkCollector.collect_links().
"""
import cgi
import functools
import itertools
import logging
import mimetypes
import os
import re
from collections import OrderedDict
from pip._vendor import html5lib, requests
from pip._vendor.distlib.compat import unescape
from pip._... | 32.59276 | 79 | 0.630941 | [
"MIT"
] | FFY00/pip | src/pip/_internal/index/collector.py | 21,609 | Python |
import tarfile
import re
import logging
from dipper.sources.Source import Source
from dipper.models.assoc.OrthologyAssoc import OrthologyAssoc
from dipper.models.Model import Model
from dipper.models.Dataset import Dataset
from dipper import config
from dipper import curie_map
__author__ = 'nicole'
logger = logging.... | 37.037825 | 79 | 0.544329 | [
"BSD-3-Clause"
] | putmantime/dipper | dipper/sources/Panther.py | 15,667 | Python |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# Vulkan CTS
# ----------
#
# Copyright (c) 2015 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 ... | 37.729239 | 225 | 0.694281 | [
"Apache-2.0"
] | LGWingEmulator/external-deqp | external/vulkancts/scripts/gen_framework.py | 54,066 | Python |
# -*- coding: utf-8 -*-
"""Title translate module."""
#
# (C) Rob W.W. Hooft, 2003
# (C) Yuri Astrakhan, 2005
# (C) Pywikibot team, 2003-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id: 790e17e8c0da2027ad0cb511c168c353056583aa $'
#... | 37.504505 | 77 | 0.515974 | [
"MIT"
] | h4ck3rm1k3/pywikibot-core | pywikibot/titletranslate.py | 4,120 | Python |
# Lint as: python2, python3
# Copyright 2019 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 req... | 40.967391 | 77 | 0.694879 | [
"Apache-2.0"
] | etarakci-hvl/tfx | tfx/components/pusher/executor_test.py | 3,769 | Python |
"""
Create a flat plate of length 1.0 with aspect ratio 2.0 and a 30-degree
inclination.
The plate is discretized with spacing 0.04 in the x-y plane and with spacing
0.04 along the z-direction.
"""
import math
import pathlib
import numpy
# Flat-plate's parameters.
L = 1.0 # chord length
AR = 2.0 # aspect ratio
xc,... | 27.794872 | 76 | 0.657749 | [
"BSD-3-Clause"
] | CFD-lab-ZJU/PetIBM | examples/decoupledibpm/flatplate3dRe100AoA30_GPU/scripts/createBody.py | 1,084 | Python |
# coding=utf-8
# Copyright 2018 The TF-Agents 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... | 34.77095 | 75 | 0.696497 | [
"Apache-2.0"
] | ChengshuLi/agents | tf_agents/environments/random_py_environment_test.py | 6,224 | Python |
# Copyright 2017 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... | 34.597826 | 78 | 0.678291 | [
"Apache-2.0"
] | openMECPlatform/apmec | apmec/conductor/conductor_server.py | 3,183 | Python |
# -*- coding: utf-8 -*-
import argparse
from GoogleScraper.version import __version__
def get_command_line(only_print_help=False):
"""
Parse command line arguments when GoogleScraper is used as a CLI application.
Returns:
The configuration as a dictionary that determines the behaviour of the app... | 58.302013 | 138 | 0.574191 | [
"Apache-2.0"
] | hnhnarek/GoogleScraper | GoogleScraper/commandline.py | 8,687 | Python |
# -*- coding: utf-8 -*-
"""
auto rule template
~~~~
:author: LoRexxar <LoRexxar@gmail.com>
:homepage: https://github.com/LoRexxar/Kunlun-M
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 LoRexxar. All rights reserved
"""
from utils.api import *
class CVI_300... | 20.185185 | 64 | 0.555046 | [
"MIT"
] | Afant1/Kunlun-M | rules/javascript/CVI_3003.py | 1,098 | Python |
'''
Exercise 5: Vectors
A vector of dimension 𝑛𝑛 can be represented by a list in Python. For example, a vector of
dimension 3 could represent a point in space, and a vector of dimension 4 could represent a
point in space and time (the fourth dimension being the time). In mathematical notation, a
vector of dimension 3... | 27.442623 | 124 | 0.717443 | [
"Apache-2.0"
] | dragoonfirestormar/SOFT1 | week4/week4_additionalexercice_5.py | 1,864 | Python |
from nose.tools import assert_equals
from framework.pages.loginPage import loginPage
from framework.pages.headerPage import headerPage
from framework.core.webdriverfactory import WebDriverFactory
from framework.core.configuration import webdriver_configuration
class testLogin():
baseUrl = "http://twiindan.python... | 26.029412 | 64 | 0.732203 | [
"Apache-2.0"
] | twiindan/selenium_lessons | 04_Selenium/framework/tests/testLogin.py | 885 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pandas as pd
class Index(object):
def __init__(self, idx):
self.idx = idx
@classmethod
def to_pandas(indices):
if isinstance(indices[0], pd.RangeIndex):
merged... | 23.045455 | 49 | 0.625247 | [
"Apache-2.0"
] | cathywu/ray | python/ray/dataframe/index.py | 507 | Python |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Stc(AutotoolsPackage):
"""STC: The Swift-Turbine Compiler"""
homepage = 'http://swif... | 34.175 | 95 | 0.659108 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 0t1s1/spack | var/spack/repos/builtin/packages/stc/package.py | 1,367 | Python |
from aws_cdk import (
aws_autoscaling as autoscaling,
aws_ec2 as ec2,
aws_ecs as ecs,
core,
)
class ECSCluster(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
... | 26.190476 | 73 | 0.583636 | [
"Apache-2.0"
] | 1digicoder/aws-cdk-examples | python/ecs/cluster/app.py | 1,100 | Python |
#!/usr/bin/env python
"""
Add docstring
"""
from datetime import datetime
from protorpc import messages
from google.appengine.ext import ndb
# Define game objects
class Game(ndb.Model):
"""Game object"""
deck = ndb.StringProperty(repeated=True)
disp_deck = ndb.StringProperty(repeated=True)
attemp... | 38.019608 | 75 | 0.685405 | [
"MIT"
] | bencam/pelmanism | models/game.py | 7,756 | Python |
import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument("-m", "--map", dest="map_id",
help="checks the leaderboard on the given beatmap id against each other")
argparser.add_argument("-u", "--user", dest="user_id",
help="checks only the given user against t... | 68.433333 | 169 | 0.649294 | [
"MIT"
] | wmpmiles/circleguard | circleguard/argparser.py | 2,053 | Python |
'''Tests about the gzippy top-level functions.'''
import unittest
from test import scratch_file
import gzippy
class GzippyTest(unittest.TestCase):
'''Tests about the gzippy top-level functions.'''
def test_open_with_plus(self):
'''Opening with r+ is not allowed.'''
with scratch_file('exam... | 26.454545 | 53 | 0.561283 | [
"MIT"
] | seomoz/gzippy | test/test_gzippy.py | 873 | Python |
import copy
import json
import logging
import warnings
import requests
from elastalert.alerter import Alerter
from elastalert.exceptions import EAException
from elastalert.utils.time import DateTimeEncoder
from elastalert.utils.util import lookup_es_key
from requests import RequestException
log = logging.getLogger(__... | 40.606452 | 87 | 0.601525 | [
"Apache-2.0"
] | JasperJuergensen/elastalert | elastalert/alerter/slack_alerter.py | 6,294 | Python |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 29 11:46:26 2022
@author: Pedro
"""
def search(lista, target) -> int:
for i in range(len(lista)):
if lista [i] == target:
return i
return -1
def search2(lista, target) -> int:
for i, element in enumerate(lista):
if element == targ... | 19.888889 | 39 | 0.553073 | [
"MIT"
] | pgentil/PC | teoria/clase 29-03/algoritmos.py | 358 | Python |
from .agent import Figaro
from .handlers.arithmetichandler import ArithmeticHandler
from .handlers.elizastatementhandler import ElizaStatementHandler
| 30.2 | 65 | 0.880795 | [
"Apache-2.0"
] | rylans/figaro | figaro/__init__.py | 151 | Python |
"""Constants used to ensure topic consistantancy."""
STANDARD_RECEIVED = "standard_received"
EXTENDED_RECEIVED = "extended_received"
X10_RECEIVED = "x10_received"
ALL_LINKING_COMPLETED = "all_linking_completed"
BUTTON_EVENT_REPORT = "button_event_report"
USER_RESET_DETECTED = "user_reset_detected"
ALL_LINK_CLEANUP_FAI... | 48.564516 | 83 | 0.878224 | [
"MIT"
] | bshep/pyinsteon | pyinsteon/topics.py | 9,033 | Python |
import numpy as np
import dem as d
from numpy.fft import fft2, ifft2, ifftshift
def calc_cdf(ks_grids, area_grids, vmax=400, R2_cutoff = 0.0, area_cutoff = 2E6, density_weighting_distance = False):
ks_vals = np.array([])
n_vals = np.array([])
R2_vals = np.array([])
density_vals = np.array([])
... | 44.076923 | 123 | 0.617801 | [
"MIT"
] | gehilley/GlobalSteepness | GlobalDataset/bin/steepness_cdf.py | 2,292 | Python |
"""Interfaces for interactively entering guesses."""
import curses
import time
import click
from wordle_cheater.interface_base import WordleCheaterUI
class CursesInterface(WordleCheaterUI):
"""Interface for using the curses library to enter guesses and display solutions.
Attributes
----------
guess... | 30.447266 | 87 | 0.545641 | [
"MIT"
] | edsq/wordle-cheater | src/wordle_cheater/interface.py | 15,589 | Python |
import asyncio
import functools
import operator
from typing import (
cast,
Iterable,
NamedTuple,
Sequence,
Type,
Tuple,
)
from cached_property import cached_property
from eth_utils import (
ExtendedDebugLogger,
to_tuple,
)
from eth_utils.toolz import groupby, valmap
from eth_keys impo... | 37.890863 | 129 | 0.681224 | [
"MIT"
] | g-r-a-n-t/trinity | p2p/handshake.py | 14,929 | Python |
"""
A module that contains utility functions to load the 'classical' workspace configuration.
This configuration may have three meaningful files:
.remote (required) - information about the connection options
.remoteindex (optional) - information about which connection from options above to use
.remoteignore (optional) ... | 36.02521 | 130 | 0.660718 | [
"BSD-2-Clause"
] | cdoronc/remote | src/remote/configuration/classic.py | 8,574 | Python |
import csv
import logging
import os
import copy
import re
import random
from functools import reduce
import ast
import pandas
import pexpect
import avi.migrationtools.netscaler_converter.ns_constants as ns_constants
from pkg_resources import parse_version
from xlsxwriter import Workbook
from openpyxl import load_workb... | 45.734504 | 85 | 0.509453 | [
"Apache-2.0"
] | avinetworks/alb-sdk | python/avi/migrationtools/netscaler_converter/ns_util.py | 88,542 | Python |
"""BitMEX API Connector."""
from __future__ import absolute_import
import requests
import time
import datetime
import json
import base64
import uuid
from market_maker.auth import APIKeyAuthWithExpires
from market_maker.utils import constants, errors, log
from market_maker.ws.ws_thread import BitMEXWebsocket
from thread... | 38.780749 | 121 | 0.574049 | [
"Apache-2.0"
] | veskokaradzhov/sample-market-maker | market_maker/bitmex.py | 14,504 | Python |
"""
Django settings for activitytracker project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR,... | 23.608108 | 72 | 0.706926 | [
"BSD-3-Clause"
] | codyowl/activitytracker | activitytracker/settings.py | 3,494 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015 Mitch Garnaat
#
# 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 appl... | 37.294118 | 74 | 0.741325 | [
"Apache-2.0"
] | BrunoCarrier/kappa | kappa/__init__.py | 634 | Python |
import io
import json
import logging
from pathlib import Path
import boto3
from ..api import API
from ..exceptions import (
SABaseException, SAExistingAnnotationClassNameException,
SANonExistingAnnotationClassNameException
)
from .project import get_project_metadata
logger = logging.getLogger("superannotate-... | 37.118519 | 206 | 0.609526 | [
"MIT"
] | yuki-inaho/superannotate-python-sdk | superannotate/db/annotation_classes.py | 15,033 | Python |
from cmstack.hdfg import hdfgutils
from cmstack.hdfg.hdfg_pb2 import Component, ValueInfo
import logging
from . import is_literal, is_number
def flatten_graph(output_graph, graph, templates, context,edge_node_ids, arg_map):
components = {}
for e in graph.edge_info:
copy_edge = ValueInfo()
if... | 35.939655 | 155 | 0.598225 | [
"Apache-2.0"
] | he-actlab/cdstack | cmstack/hdfg/passes/flatten.py | 8,338 | Python |
"""FastAPI Project for CodeSpace.
https://csdot.ml
"""
| 13.75 | 33 | 0.690909 | [
"Apache-2.0"
] | codespacedot/CodeSpaceAPI | src/__init__.py | 55 | Python |
import cv2
import os,shutil
import numpy as np
from Adb import Adb
import time
class Photo():
'''
提取图片信息,比较图片
'''
def __init__(self,img_path) -> None:
'''
读取图片
'''
self.img = cv2.imread(img_path)
class sourceData():
'''
获取测试数据
'''
def ... | 28.114286 | 118 | 0.579776 | [
"MIT"
] | Rougnt/ArkNightAutoClick | Photo.py | 2,128 | Python |
#!/usr/bin/env python
# this node will be implemented on the master node
# this is a test script for drive motor
# in function of stop and front lights detection
# this script will be implemented in another node
# import libraries
import rospy,sys,time,atexit,numpy
from std_msgs.msg import String,Int16MultiArray
... | 23.844828 | 83 | 0.737527 | [
"BSD-3-Clause"
] | isarlab-department-engineering/ros-stop-light-control | deprecated/led_control.py | 1,383 | Python |
from dataclasses import dataclass, field
from typing import List
from bindings.wfs.range import Range
__NAMESPACE__ = "http://www.opengis.net/ows/1.1"
@dataclass
class AllowedValues:
"""List of all the valid values and/or ranges of values for this quantity.
For numeric quantities, signed values should be or... | 23.272727 | 78 | 0.598958 | [
"Apache-2.0"
] | NIVANorge/s-enda-playground | catalog/bindings/wfs/allowed_values.py | 768 | Python |
import importlib
import inspect
import os
import sys
import warnings
from abc import ABCMeta, abstractmethod
from collections import namedtuple
import six
from dagster import check
from dagster.core.errors import DagsterInvariantViolationError
from dagster.serdes import whitelist_for_serdes
from dagster.seven import ... | 39.030769 | 100 | 0.659361 | [
"Apache-2.0"
] | idjevm/dagster | python_modules/dagster/dagster/core/code_pointer.py | 12,685 | Python |
# -*- coding: utf-8 -*-
import torch
from supar.utils.common import MIN
from supar.utils.fn import pad
from torch.autograd import Function
def tarjan(sequence):
r"""
Tarjan algorithm for finding Strongly Connected Components (SCCs) of a graph.
Args:
sequence (list):
List of head indi... | 34.55814 | 127 | 0.574361 | [
"MIT"
] | zysite/parser | supar/structs/fn.py | 8,916 | Python |
# -*- coding: latin-1 -*-
# -----------------------------------------------------------------------------
# Copyright 2009-2011 Stephen Tiedemann <stephen.tiedemann@googlemail.com>
#
# Licensed under the EUPL, Version 1.1 or - as soon they
# will be approved by the European Commission - subsequent
# versions of the EU... | 38.011146 | 79 | 0.548071 | [
"MIT"
] | javgh/bitpay-brick | src/nfc/llcp/llc.py | 23,871 | Python |
import os
import cv2
import numpy as np
import time
cap = cv2.VideoCapture(0)
file_index = 0
if not os.path.exists("calibration_data/calibration_frames/"):
os.makedirs("calibration_data/calibration_frames/")
while True:
ret, frame = cap.read()
# display the resulting frame
cv2.imshow("frame", frame... | 21.677419 | 109 | 0.654762 | [
"MIT"
] | federicozappone/sun_sensor_heading_estimation | grab_calibration_frames.py | 672 | Python |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QGIS plugin 'Graphium'
/***************************************************************************
*
* Copyright 2020 Simon Gröchenig @ Salzburg Research
* eMail graphium@salzburgresearch.at
*
* Licensed... | 31.092593 | 77 | 0.59321 | [
"Apache-2.0"
] | graphium-project/graphium-qgis-plugin | graphium/graph_management/model/osm_highway_types.py | 1,680 | Python |
# Copyright 2018 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, ... | 42.566449 | 80 | 0.749718 | [
"Apache-2.0"
] | berlinguyinca/deep-molecular-massspec | make_train_test_split.py | 19,538 | Python |
class Solution(object):
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
def recurhelper(nums,res,path,target,start):
if target==0:
res.append(path)
... | 29.434783 | 77 | 0.483013 | [
"MIT"
] | Tanych/CodeTracking | 39-Combination-Sum/solution.py | 677 | Python |
playlists = """https://www.youtube.com/playlist?list=PLWOxuTkHhAq70Q4ZF1EcsRaW1uHs6zygL
https://www.youtube.com/playlist?list=PLObmubSxSaRKdWB3BoyndydqDGkgbMlbC
https://www.youtube.com/playlist?list=PLxN__ARc_RfpOAdnB14rBSF6xDHDySNE4
https://www.youtube.com/playlist?list=PLxN__ARc_Rfrsee6JJkU198Fa0rxjbTgQ
https://www.y... | 70.388889 | 87 | 0.866219 | [
"MIT"
] | portikCoder/yt-list-downloader | src/yt_list_downloader/input.py | 2,534 | Python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v3/proto/services/campaign_criterion_simulation_service.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
fro... | 56.769912 | 1,247 | 0.833983 | [
"Apache-2.0"
] | BenRKarl/google-ads-python | google/ads/google_ads/v3/proto/services/campaign_criterion_simulation_service_pb2.py | 6,415 | Python |
import numpy as np
from env import Env
from models import PolicyNet, Critic
from utils import one_hot
import torch
from torch.optim import Adam
import time
import os
from datetime import datetime
import math
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
#------------------------SET PARAMETE... | 33.018692 | 109 | 0.589301 | [
"MIT"
] | jomavera/DRL_HFV | infer.py | 3,533 | Python |
"""File Converter
.nfc """
import asyncio
import os
import time
from datetime import datetime
from userbot.utils import admin_cmd, progress
@borg.on(admin_cmd(pattern="nfc (.*)")) # pylint:disable=E0602
async def _(event):
if event.fwd_from:
return
input_str = event.pattern_match.group(1)
reply_... | 37.110092 | 103 | 0.5644 | [
"MIT"
] | anandhu-dev/catuserbot | userbot/plugins/fconvert.py | 4,048 | Python |
#!/usr/bin/env python3
import pwncat
from pwncat.commands import CommandDefinition
class Command(CommandDefinition):
"""
Exit the interactive prompt. If sessions are active, you will
be prompted to confirm. This shouldn't be run from a configuration
script.
"""
PROG = "exit"
ARGS = {}
... | 21.789474 | 70 | 0.683575 | [
"MIT"
] | Mitul16/pwncat | pwncat/commands/exit.py | 414 | Python |
from __future__ import absolute_import
#SymPy is a non-commercial alternative to Mathematica and Maple
# SymPy can map variable to a value or a matrix.
# SymPy's Symbolic Statistical Modelling uses scintific computing.
import sys
import numpy as np
import sympy as sp
import pandas as pd
from pathlib import Path
from .... | 41.781818 | 112 | 0.691036 | [
"MIT"
] | sushmaakoju/parser | src/equation_parser/equations.py | 2,298 | Python |
from win32com import storagecon
import pythoncom, os, win32api
import win32com.test.util
import unittest
class TestEnum(win32com.test.util.TestCase):
def testit(self):
fname, tmp = win32api.GetTempFileName(win32api.GetTempPath(),'stg')
m=storagecon.STGM_READWRITE | storagecon.STGM_SHARE_E... | 54.935484 | 167 | 0.644745 | [
"Apache-2.0"
] | Matchoc/python_env | python35/Lib/site-packages/win32com/test/testStorage.py | 3,406 | Python |
"""A simple CLI app to practice grammatical genders of German nouns."""
import argparse
import json
import pathlib
import pandas as pd
class WordList:
"""Data structure to store a pandas dataframe and some structural details.
Args:
path (pathlib.Path or None): The path (without suffix) to a wor... | 32.370546 | 91 | 0.587981 | [
"MIT"
] | n-Holmes/deutscheflash | deutscheflash.py | 13,628 | Python |
from django.test import TestCase, override_settings
from api.tests.fixtures import patch_requests
from .. import client
@patch_requests
@override_settings(
VBO_URI_TEMPLATE="http://api/bag/verblijfsobject/{landelijk_id}/")
class ClientTest(TestCase):
def setUp(self):
self.client = client.Client()
... | 32.257143 | 70 | 0.719221 | [
"MPL-2.0"
] | Amsterdam/zwaailicht | web/zwaailicht/api/tests/test_client.py | 1,129 | Python |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]:
if head is None:
return None
odd, even = ... | 27.103448 | 74 | 0.493639 | [
"MIT"
] | MayaScarlet/leetcode-python | 328-odd-even-linked-list/328-odd-even-linked-list.py | 786 | Python |
# services/resource/project/utils/enums.py
from enum import Enum
class Status(Enum):
normal = 0
delete = 1
other = 2
class Scope(Enum):
user = 'UserScope'
admin = 'AdminScope'
| 12.625 | 42 | 0.643564 | [
"MIT"
] | spruce-cq/sblog | services/resource/project/utils/enums.py | 202 | Python |
import os
import shutil
#for i in range(8050,8051):
# old=str(i) + '.bin'
# new="../new/"+'%06d.bin' % i
# shutil.move(old,new)
file1 = open('a.txt', 'r')
Lines = file1.readlines()
file2 = open('b.txt', 'r')
Lines2 = file2.readlines()
calib_DIR='./calib/'
img_DIR='./image_2/'
label_DIR='./label_2/'
pcl_... | 26.4 | 72 | 0.655303 | [
"MIT"
] | UILXELA/Cooperative-3D-Object-Detection-Using-Shared-Raw-LIDAR-Data | useful_scripts/split.py | 792 | Python |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_warren_bors_teraud.iff"
result.attribute_template_id = 9
resu... | 26.235294 | 64 | 0.730942 | [
"MIT"
] | SWGANHServices/GameServer_Legacy | data/scripts/templates/object/mobile/shared_warren_bors_teraud.py | 446 | Python |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | 37.927039 | 133 | 0.640715 | [
"Apache-2.0",
"CC0-1.0"
] | adityaviki/scancode-toolk | tests/extractcode/extractcode_assert_utils.py | 8,837 | Python |
import os
import unittest
from tests.base import (
HPSS_ARCHIVE,
TOP_LEVEL,
ZSTASH_PATH,
TestZstash,
compare,
print_starred,
run_cmd,
write_file,
)
class TestUpdate(TestZstash):
"""
Test `zstash --update`.
"""
# x = on, no mark = off, b = both on and off tested
# ... | 32.274286 | 112 | 0.561969 | [
"BSD-3-Clause"
] | E3SM-Project/zstash | tests/test_update.py | 5,648 | Python |
# -*- coding: utf-8 -*-
"""
Created on Wed May 9 14:25:47 2018
@author: Steven
"""
import sys
import argparse
from radioxenon_ml.read_in import ml_matrix_composition as mlmc
from radioxenon_ml.solve import iterate
import numpy as np
"""
import radioxenon_ml.read_in.ml_matrix_composition
import radioxenon_ml.solve.it... | 43.025641 | 138 | 0.690703 | [
"MIT"
] | sczyz/radioxenon_ml | ml_rxe.py | 1,678 | Python |
""" A class for testing a SSD model on a video file or webcam """
import cv2
import keras
from keras.applications.imagenet_utils import preprocess_input
from keras.backend.tensorflow_backend import set_session
from keras.models import Model
from keras.preprocessing import image
import pickle
import numpy as np
from r... | 41.625 | 100 | 0.536362 | [
"MIT"
] | hanhejia/SSD | testing_utils/videotest.py | 7,659 | Python |
# 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, ... | 26.194969 | 80 | 0.677791 | [
"Apache-2.0"
] | google/jax-cfd | jax_cfd/base/time_stepping.py | 4,171 | Python |
import base64
import numpy as np
import cv2
path_save = "./images/"
def base64_cv2(base64_str):
imgString = base64.b64decode(base64_str)
nparr = np.fromstring(imgString,np.uint8)
image = cv2.imdecode(nparr,cv2.IMREAD_COLOR)
a = cv2.imwrite(path_save + "img_face_1" + ".jpg", image)
print(a)
r... | 438.5 | 9,266 | 0.94589 | [
"Apache-2.0"
] | Cambio-Project/trainticket-fork | ts-avatar-service/base64toimage.py | 9,647 | Python |
# Copyright (c) 2015 Huawei Technologies Co., Ltd.
# 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
#
# ... | 41.274021 | 79 | 0.604846 | [
"Apache-2.0"
] | Huawei/OpenStack_Driver | Cinder/Mitaka/extend/fc_zone_helper.py | 11,598 | Python |
# This code is licensed under the MIT License (see LICENSE file for details)
import concurrent.futures as futures
import contextlib
import inspect
import json
import logging
import pathlib
import platform
import sys
import time
from zplib import datafile
from zplib.image import threaded_io
from elegant import load_da... | 47.837423 | 122 | 0.648092 | [
"MIT"
] | drew-sinha/rpc-scope | scope/timecourse/base_handler.py | 15,595 | Python |
from logging import warning
from os import path
from typing import Optional, List
from lxml.html import HtmlElement
from manga_py.http import Http
from .params import ProviderParams
class Base(ProviderParams):
_storage = None
_params = None
_image_params = None
_http_kwargs = None
__http = None
... | 29.748344 | 87 | 0.573241 | [
"MIT"
] | Ever4engel/manga-py | manga_py/base_classes/base.py | 4,492 | Python |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
# SECURITY WARNING: keep the... | 25.517857 | 91 | 0.689293 | [
"MIT"
] | anthonyc1/django-materialize-boilerplate | myProject/settings.py | 2,858 | Python |
# coding: utf-8
"""
Genomic Data Store Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
imp... | 28.503311 | 124 | 0.58434 | [
"MIT"
] | umccr-illumina/libica | libica/openapi/libgds/models/folder_update_request.py | 4,304 | Python |
import numpy as np
from mendeleev import element as md_element
from basisopt import api, data
from basisopt.exceptions import PropertyNotAvailable
from basisopt.basis import even_temper_expansion
from basisopt.basis.guesses import null_guess
from .preconditioners import unit
from .strategies import Strategy
_INITIAL_... | 37.758065 | 89 | 0.566852 | [
"MIT"
] | robashaw/basisopt | basisopt/opt/eventemper.py | 4,682 | Python |
import os
import sys
sys.path.append(os.getcwd())
import numpy as np
import torch
import flow
from utils import cdfDiscreteLogitstic, cdfMixDiscreteLogistic
from utils import logDiscreteLogistic, logMixDiscreteLogistic
nbins = 4096
_bins = torch.arange(-nbins // 2, nbins // 2).reshape(-1, 1, 1, 1, 1)
decimal = flow.... | 36.19084 | 125 | 0.494832 | [
"Apache-2.0"
] | li012589/NeuralWavelet | test/test_cdf.py | 4,741 | Python |
# Copyright 2019 TerraPower, 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 writi... | 33.766798 | 97 | 0.64626 | [
"Apache-2.0"
] | sammiller11235/armi | armi/utils/directoryChangers.py | 8,543 | Python |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
import os
import zipfile
from dataclasses import dataclass
from io import BytesIO
from typing import Iterable
from pants.backend.python.... | 40.045977 | 100 | 0.708668 | [
"Apache-2.0"
] | chebbyChefNEQ/pants | src/python/pants/backend/python/util_rules/local_dists.py | 6,968 | Python |
from fastai.data.all import IntToFloatTensor
from fastai.vision.learner import *
from fastai.vision.augment import *
from fastai.vision.core import PILImageBW, PILImage
from fastai.vision.data import *
from preprocessing.transforms import *
# from preprocessing.dicom import *
from preprocessing.misc import *
def ge... | 30.303448 | 197 | 0.561447 | [
"MIT"
] | lluissalord/radiology_ai | train/tfms.py | 4,394 | Python |
import sys,os
try:
import argparse
except ImportError:
print("""ERROR: Could not import argparse
Either use python2.7 or later (perhaps in a strange location such as
/bgsys/tools/python2.7.5-gnu-20130730/bin/hostpython) or install from
PyPI (https://pypi.python.org/pypi/argparse/).""")
sys.exit(1)
def mkd... | 48.176 | 185 | 0.622551 | [
"Unlicense"
] | kyushick/cdruntime | examples/hpgmg/hpgmgconf.py | 6,022 | Python |
from typing import Any
from typing import Mapping
from pandas.core.frame import DataFrame
from pyspark.sql import SparkSession
from pyspark.sql.types import StructType
from cishouseholds.pipeline.config import get_config
sessions = {
"s": (
SparkSession.builder.config("spark.executor.memory", "1g")
... | 39.271028 | 90 | 0.6604 | [
"MIT"
] | ONS-SST/cis_households | cishouseholds/pyspark_utils.py | 4,202 | Python |
from flask import Flask, render_template, request
import model
from model import get_headlines
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
url = request.form['url']
predict = model.predict(url)
value = predict[1]
clickbait = pr... | 5.229381 | 121 | 0.377526 | [
"MIT"
] | asaxena2019/FakeNewsify-Article-Credibility-Checker | app.py | 2,029 | Python |
from keras.models import load_model
from glob import glob
from metrics import auc, precision, recall, f1
def save_json(model, path):
model_json = model.to_json()
with open(path, "w") as json_file:
json_file.write(model_json)
def save_weights(model, path):
model.save_weights(path)
def resave_mo... | 33.90625 | 74 | 0.588018 | [
"MIT"
] | eugene-vasilev/Automatic-Tool-Annotation-for-CATARACT-Surgery | learning/model/keras_model_resave.py | 1,085 | Python |
from panda3d.core import *
from direct.distributed.PyDatagram import PyDatagram
from OTPInternalRepository import OTPInternalRepository
from direct.directnotify import DirectNotifyGlobal
from game.OtpDoGlobals import *
from realtime.types import *
from direct.distributed.AIZoneData import AIZoneDataStore
from game.Time... | 33.71875 | 107 | 0.713315 | [
"BSD-3-Clause"
] | AnythingTechPro/toontown-otp-original | game/AIRepository.py | 3,237 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.