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 |
|---|---|---|---|---|---|---|---|---|
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowSecurityGroupRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): T... | 27.657895 | 89 | 0.574691 | [
"Apache-2.0"
] | huaweicloud/huaweicloud-sdk-python-v3 | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | 3,173 | Python |
from lark import Lark, Transformer, v_args
from lark.visitors import Interpreter, visit_children_decor
p = Lark.open("rules.lark", parser="lalr", rel_to=__file__)
code = """
// Firrst win in my book
b = 4;
a = b*2;
print a+1
x = 7;
p = [1, 2, 3, 4]
print p
"""
tree = p.parse(code)
@v_args(inline=True)
class MyEval... | 18.553571 | 61 | 0.638114 | [
"Apache-2.0"
] | RLToolsWorkshop/dubdub | tests/cmdexpr/ruler.py | 1,039 | Python |
# coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose" file="error_details.py">
# Copyright (c) 2020 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of thi... | 33.772727 | 87 | 0.580585 | [
"MIT"
] | rizwanniazigroupdocs/aspose-words-cloud-python | asposewordscloud/models/error_details.py | 5,944 | Python |
import datetime
from flask_restplus import Namespace, Resource
from flask_login import login_required, current_user
from flask import request
from ..util import query_util, coco_util, profile
from config import Config
from database import (
ImageModel,
CategoryModel,
AnnotationModel,
SessionEvent
)
... | 36.338384 | 109 | 0.577623 | [
"MIT"
] | Cheol-H-Jeong/Deep-POC-2019 | coco-annotator/backend/webserver/api/annotator.py | 7,195 | Python |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 39.551724 | 266 | 0.671898 | [
"Apache-2.0",
"BSD-3-Clause"
] | pabs3/oci-python-sdk | src/oci/data_integration/models/update_connection_from_amazon_s3.py | 6,882 | Python |
import logging
import threading
import time
import traceback
import warnings
from ..machine.machine import TlMachine
LOG = logging.getLogger(__name__)
class Invoker:
def __init__(self, data_controller):
self.data_controller = data_controller
self.exception = None
threading.excepthook = s... | 24.766667 | 62 | 0.650067 | [
"Apache-2.0"
] | condense9/hark-lang | src/hark_lang/executors/thread.py | 743 | Python |
#!/usr/bin/env python
"""
<Program Name>
test_root_versioning_integration.py
<Author>
Evan Cordell.
<Started>
July 21, 2016.
<Copyright>
See LICENSE for licensing information.
<Purpose>
Test root versioning for efficient root key rotation.
"""
from __future__ import print_function
from __future__ import... | 37.349138 | 98 | 0.734795 | [
"MIT"
] | ninox-iot/tuf | tests/test_root_versioning_integration.py | 8,665 | Python |
from datetime import datetime
from django.db import models
# Create your models here.
class JD(models.Model):
appkey = models.CharField(max_length=100,verbose_name='appkey')
secret = models.CharField(max_length=100,verbose_name='secret')
add_time = models.DateTimeField(default=datetime.now,verbose_name=... | 24.9 | 87 | 0.690189 | [
"MIT"
] | fengjinqi/linjuanbang | apps/jd_app/models.py | 1,953 | Python |
from mle_scheduler.cluster.slurm.helpers_launch_slurm import slurm_generate_startup_file
job_arguments = {
"num_logical_cores": 5,
"partition": "standard",
"job_name": "test_job",
"num_gpus": 1,
"gpu_type": "RTX2080",
"env_name": "test_env",
"use_conda_venv": True,
"script": "python run... | 32.44898 | 88 | 0.510063 | [
"MIT"
] | boazbk/mle-scheduler | tests/test_job_slurm.py | 1,590 | Python |
"""
This file imports `__all__` from the solvers directory, thus populating the solver registry.
"""
from pysperf.solvers import *
from .config import solvers
__all__ = ['solvers']
| 20.333333 | 92 | 0.748634 | [
"BSD-2-Clause"
] | ZedongPeng/pysperf | pysperf/solver_library.py | 183 | Python |
font = CurrentFont()
one = font['A']
two = font['A.2']
steps = 4
if one.isCompatible(two):
for x in range(steps):
n = "A.interp" + str(x+1)
g = font.newGlyph(n)
f = (x+1)/(steps+1)
print f
g.interpolate(f, one, two) | 18.714286 | 34 | 0.515267 | [
"MIT"
] | benkiel/python_workshops | 2018_3_Cooper_Type/RoboFont/simple_interpolation.py | 262 | Python |
# Copyright 2013-2022 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)
class Volk(CMakePackage):
"""VOLK is the Vector-Optimized Library of Kernels. It is a
library that contains kerne... | 41.967742 | 95 | 0.734051 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | Bambi/spack | var/spack/repos/builtin/packages/volk/package.py | 1,301 | Python |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | 40.333333 | 100 | 0.771074 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | AdrianMirandaTailor/RaWorkflowOrchestrator | airflow/contrib/operators/emr_add_steps_operator.py | 1,210 | Python |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors,
# The HuggingFace Inc. team, and The XTREME Benchmark Authors.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with th... | 46.527256 | 259 | 0.688153 | [
"Apache-2.0"
] | rohanshah13/cloud-emea-copy | third_party/ridayesh_run_tag.py | 52,064 | Python |
# The MIT License (MIT)
#
# Copyright (c) 2016 Oracle
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | 42.946309 | 153 | 0.643694 | [
"MIT"
] | LaudateCorpus1/atg-commerce-iaas | common-python/oc_provisioning/oc_provision_wrappers/database/v11g/oracle_rdbms_clone.py | 6,399 | Python |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 37.993528 | 80 | 0.725639 | [
"Apache-2.0"
] | 188080501/tensorflow | tensorflow/contrib/lite/python/op_hint.py | 11,740 | Python |
#!/usr/bin/python
# vim:fileencoding=utf-8
#
# Lookup for MX and NS records
#
import unbound
ctx = unbound.ub_ctx()
ctx.resolvconf("/etc/resolv.conf")
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
if status == 0 and result.havedata:
print "Result:"
print " raw data:", re... | 28.6875 | 79 | 0.650327 | [
"BSD-3-Clause"
] | 1Blackdiamondsc/haven | external/unbound/libunbound/python/doc/examples/example8-1.py | 918 | Python |
#!/usr/bin/python3
import sys
import os
import shutil
import csv
import zipfile
import pandas as pd
import glob
infile = sys.argv[1]
outfile = sys.argv[2]
# remove holding_folder if it exists, and create new folder
# use 'rm -r /holding_folder/* in shell script instead?'
holding_path = '/media/secure_volume/holding_... | 34.042857 | 90 | 0.684012 | [
"MIT"
] | afcarl/biographies | code/extract_balanced.py | 2,383 | Python |
#Faça um algoritmo utilizando o comando while que mostra uma
#contagem regressiva na tela, iniciando em 10 e terminando
#em O. Mostrar uma mensagem “FIM!" após a contagem.
i=11
while(i!=0):
i-=1
print(i)
print("FIM") | 28 | 60 | 0.71875 | [
"MIT"
] | AlexandrePeBrito/CursoUdemyPython | exercicios/Lista3/Q3.py | 228 | Python |
# Columbus - A Smart Navigation System for the Visually-Impaired
# Ike Kilinc
# This file integrates Columbus' primary start location and destination input
# features with its core pathfinding algorithm. This file also facilitates
# Columbus' speech recognition and audio functionalities.
from speech_to_text import *
... | 32.212766 | 108 | 0.628666 | [
"MIT"
] | ikekilinc/Columbus | main_algo.py | 7,570 | Python |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2018, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | 31.333333 | 78 | 0.556738 | [
"BSD-3-Clause"
] | ChrisKeefe/q2-emperor | q2_emperor/tests/test_plugin_setup.py | 564 | Python |
"""
Generate configuration files into :ref:`generated_dir<directories>`.
"""
from fabric.api import task
from gusset.output import status
from gusset.validation import with_validation
from confab.iter import iter_conffiles
@task
@with_validation
def generate(directory=None):
"""
Generate configuration files.... | 24.565217 | 71 | 0.707965 | [
"Apache-2.0"
] | locationlabs/confab | confab/generate.py | 565 | Python |
import unittest
from cloudmitigator_semantic import version
class VersionTestCase(unittest.TestCase):
def test_proper_version_parsing(self):
proper_version = version.Version("v5.1.2")
self.assertEqual(proper_version.major, 5)
self.assertEqual(proper_version.minor, 1)
self.assertE... | 34.847458 | 69 | 0.695525 | [
"MPL-2.0"
] | reflexivesecurity/semantic | tests/test_version_object.py | 2,056 | Python |
from habit.habit_model import HabitHistory
from habit.complete_habit import complete
def test_overdue_habit(datasett):
"""
please note the 'double tt' for datasett. This stands to differentiate
the functional test data from the data used for unit tests.
habit 1 is the overdue habit since its added fir... | 29.515152 | 75 | 0.687885 | [
"MIT"
] | takavarasha-desire/habittracker1_1 | tests/func/test_complete_habit.py | 974 | Python |
#!/usr/bin/python3
"""Alta3 Research - Exploring OpenAPIs with requests"""
# documentation for this API is at
# https://anapioficeandfire.com/Documentation
import requests
AOIF = "https://www.anapioficeandfire.com/api"
def main():
## Send HTTPS GET to the API of ICE and Fire
gotresp = requests.get(AOIF)
... | 20.727273 | 55 | 0.686404 | [
"MIT"
] | AgentKD6-37/2022-01-04-Python | Day 6/iceAndFire01.py | 456 | Python |
import time
from torch.utils.tensorboard import SummaryWriter
import numpy as np
class LossWriter(SummaryWriter):
def __init__(self, log_dir=None, comment=''):
if log_dir == None:
log_dir = './logs/tensorboard/' + time.strftime('%Y-%m-%d--%H-%M-%S', time.localtime(time.time()))
super(... | 29.090909 | 110 | 0.676563 | [
"MIT"
] | wooseoklee4/AP-BSN | src/util/summary_logging.py | 640 | Python |
from __future__ import unicode_literals
from django.db import models
from model_utils import Choices
from model_utils.models import TimeStampedModel, StatusModel
from django.conf import settings
class Booking(TimeStampedModel, StatusModel):
TRAVEL_CLASSES = Choices('economy', 'first_class')
STATUS = Choices((... | 48 | 106 | 0.778646 | [
"MIT"
] | savioabuga/lipame | lipame/lipa/models.py | 768 | Python |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | 38.380117 | 174 | 0.590279 | [
"Apache-2.0"
] | jetbridge/openapi-generator | samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer_default_value.py | 6,563 | Python |
from math import pi, sqrt
from typing import List
import numpy as np
import pytest
from src.kinematics.forward_kinematics import get_tform
from src.prechecks.spatial_interpolation import linear_interpolation, circular_interpolation
@pytest.mark.parametrize("start,end,ds,expected_points",
[
... | 47.64 | 110 | 0.34047 | [
"MIT"
] | pat-bert/gcode | test/test_spatial_interpolation.py | 7,146 | Python |
n = int(input())
c = int(input())
lista = input().split()
graph = [[0 for i in range(n)] for j in range(n)]
cont = 0
for i in range(n):
for j in range(n):
graph[i][j] = int(lista[cont])
cont += 1
if i == j:
graph[i][j] = 0
listaMemoria = [c]
contaminados = []
contaminados.append(... | 23.181818 | 49 | 0.48366 | [
"MIT"
] | Vith-MCB/UFV | UFV---Python/Trabalho Mat. Disc/grafo_4675.py | 765 | Python |
import csv
import six
import sys
import time
from datetime import (
datetime,
date,
timedelta,
)
from xml.etree import cElementTree as ElementTree
from django.core.management.base import BaseCommand
from corehq.apps.users.util import SYSTEM_USER_ID
from corehq.form_processor.backends.sql.dbaccessors impo... | 41.84507 | 102 | 0.62392 | [
"BSD-3-Clause"
] | dungeonmaster51/commcare-hq | custom/icds/management/commands/populate_mother_name.py | 8,913 | Python |
"""Class to manage the entities for a single platform."""
import asyncio
from homeassistant.const import DEVICE_DEFAULT_NAME
from homeassistant.core import callback, valid_entity_id, split_entity_id
from homeassistant.exceptions import HomeAssistantError, PlatformNotReady
from homeassistant.util.async_ import (
ru... | 38.491726 | 78 | 0.605577 | [
"Apache-2.0"
] | crazyfish1111/home-assistant | homeassistant/helpers/entity_platform.py | 16,282 | Python |
from __future__ import annotations
import typing
if typing.TYPE_CHECKING:
from typing import Optional, Union, Any, Dict
from pypbbot.driver import AffairDriver
from pypbbot.typing import Event
from pypbbot.utils import Clips
from pypbbot.protocol import GroupMessageEvent, PrivateMessageEvent
from ... | 31.87931 | 123 | 0.685776 | [
"MIT"
] | PHIKN1GHT/pypbbot_archived | pypbbot/affairs/builtin.py | 1,849 | Python |
# The most basic of settings to get the app to run as an example, should *never* be used in a
# production environment.
import os
import dj_database_url
DATABASES = {}
db_url = os.environ.get('DATABASE_URL', '')
if db_url:
DATABASES['default'] = dj_database_url.parse(db_url, conn_max_age=600, ssl_require=True)
el... | 27.885714 | 93 | 0.653176 | [
"BSD-3-Clause"
] | AngelKey/Angelkey.proofintegration | test_app/settings.py | 1,952 | Python |
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 33.582677 | 78 | 0.617468 | [
"Apache-2.0"
] | Chetank99/cuml | python/cuml/dask/cluster/kmeans.py | 8,530 | Python |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 41.84252 | 80 | 0.684136 | [
"Apache-2.0"
] | 1244783394/tensorflow | tensorflow/contrib/model_pruning/python/pruning_test.py | 10,628 | Python |
"""Adapted from:
@longcw faster_rcnn_pytorch: https://github.com/longcw/faster_rcnn_pytorch
@rbgirshick py-faster-rcnn https://github.com/rbgirshick/py-faster-rcnn
Licensed under The MIT License [see LICENSE for details]
"""
from __future__ import print_function
import torch
import torch.nn as nn
import to... | 36.43018 | 109 | 0.563277 | [
"MIT"
] | FLyingLSJ/ssd.pytorch | eval.py | 16,187 | Python |
# Webhooks for external integrations.
from functools import partial
from typing import Any, Callable, Dict, Optional
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_s... | 34.308411 | 99 | 0.701989 | [
"Apache-2.0"
] | D-MaaS/zulip | zerver/webhooks/groove/view.py | 3,671 | Python |
import unittest
import bibdeskparser
from bibdeskparser.bparser import BibTexParser
from tempfile import TemporaryFile
class TestbibdeskparserParserMethods(unittest.TestCase):
input_file_path = 'tests/data/book.bib'
input_bom_file_path = 'tests/data/book_bom.bib'
entries_expected = [
{
... | 35.587719 | 72 | 0.676608 | [
"BSD-3-Clause"
] | goerz/bibdeskparser | tests/test_bibtexparser.py | 4,057 | Python |
import pandas as pd
import tweepy
from textblob import TextBlob
from wordcloud import WordCloud
import plotly.graph_objs as go
import os
import re
import pystan
import numpy as np
import streamlit as st
import matplotlib.pyplot as plt
import yfinance as yf
from fbprophet import Prophet
from fbprophet.plot import plo... | 27.208048 | 870 | 0.6082 | [
"Apache-2.0"
] | krishnaaxo/Finance-Forcasting-Dashboard | app.py | 31,779 | Python |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="faust_pydantic_validate",
version="0.0.1",
author="Alexey Kuzyashin",
author_email="alex@rocketcompute.com",
description="A small decorator for post data view validation",
long_descrip... | 28.703704 | 66 | 0.651613 | [
"MIT"
] | Kuzyashin/faust-pydantic-validate | setup.py | 775 | Python |
"""adding cluster control options on every level
Revision ID: a987c6ce888d
Revises: 00c5cc87408d
Create Date: 2018-08-01 18:34:00.415937
"""
import logging
from alembic import op
import sqlalchemy as sa
revision = 'a987c6ce888d'
down_revision = '8079a1cb5874'
branch_labels = None
depends_on = None
logger = logging.g... | 35.111111 | 78 | 0.643038 | [
"MIT"
] | hanakhry/Crime_Admin | python-news_aggregator/migrations/versions/20180830_cluster_control.py | 1,580 | Python |
import os
import time
import re
from flask import url_for
from . util import set_original_response, set_modified_response, live_server_setup
import logging
from changedetectionio.notification import default_notification_body, default_notification_title
# Hard to just add more live server URLs when one test is already ... | 38.991266 | 121 | 0.634786 | [
"Apache-2.0"
] | Pritam-Patra/changedetection.io | changedetectionio/tests/test_notification.py | 8,929 | Python |
import json
import pickle
from TwitterAPI import TwitterAPI
with open("api_key.json") as json_data:
all_keys = json.load(json_data)
consumer_key = all_keys["consumer_key"]
consumer_secret = all_keys["consumer_secret"]
access_token_key = all_keys["access_token_key"]
access_token_secret = all_keys["a... | 25.093023 | 89 | 0.677479 | [
"MIT"
] | hallowf/MotivationalBinary | search_to_follow.py | 1,079 | Python |
"""Connection pooling for psycopg2
This module implements thread-safe (and not) connection pools.
"""
# psycopg/pool.py - pooling code for psycopg
#
# Copyright (C) 2003-2010 Federico Di Gregorio <fog@debian.org>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU Less... | 34.474576 | 78 | 0.615044 | [
"MIT"
] | ALEXIS2ES/sherom-Serve | lexis/Lib/site-packages/psycopg2/pool.py | 8,136 | Python |
import frappe, re
from renovation_service_provider_manager import invoke_mediator
@frappe.whitelist(allow_guest=True)
def get_service_provider_client_id(provider):
k = f"client_id_{re.sub('[^0-9a-zA-Z]+', '_', provider.lower())}"
client_id = frappe.cache().get_value(k)
if client_id:
return client_id
clien... | 31.434783 | 117 | 0.749654 | [
"MIT"
] | leam-tech/renovation_service_provider_manager | renovation_service_provider_manager/api/__init__.py | 723 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2022 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
from math import pi
from numpy import sign, nan, append, zeros, array, sqrt, where
from numpy import max as max_
from pandas impor... | 48.93517 | 103 | 0.568509 | [
"BSD-3-Clause"
] | BaraaUniKassel/pandapower | pandapower/converter/pypower/from_ppc.py | 30,193 | Python |
from setuptools import setup, find_packages
import os
setup(name='avenue',
version=0.1,
description='Element AI car Simulator',
url='https://github.com/cyrilibrahim/Avenue',
author='ElementAI',
author_email='cyril.ibrahim@elementai.com',
license='',
zip_safe=False,
insta... | 28.909091 | 128 | 0.613208 | [
"MIT"
] | ElementAI/avenue | setup.py | 636 | Python |
import warnings
import numpy as np
import pandas as pd
import pandas.util.testing as tm
try:
from pandas.api.types import union_categoricals
except ImportError:
try:
from pandas.types.concat import union_categoricals
except ImportError:
pass
class Concat:
def setup(self):
N =... | 28.316498 | 77 | 0.592271 | [
"BSD-3-Clause"
] | FerhatYilmaz1986/pandas | asv_bench/benchmarks/categoricals.py | 8,410 | Python |
import astropy.io.fits as fits
import argparse, os, re, copy
parser = argparse.ArgumentParser()
parser.add_argument('--list', default='list.list')
parser.add_argument('--rename_by', default='DATA-TYP')
parser.add_argument('--reparse', default=0, type=int)
args = parser.parse_args()
def log(description):
print(descr... | 21.431818 | 54 | 0.645811 | [
"MIT"
] | hletrd/PyAstrophotography | autorenamer.py | 943 | Python |
import collections
Set = set
KEY, PREV, NEXT = range(3)
class OrderedSet(collections.MutableSet):
"""
From: http://code.activestate.com/recipes/576694/
"""
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.map = {} ... | 22.828947 | 74 | 0.591931 | [
"Apache-2.0"
] | gantech/fastv8DriverProgram | fastv8/doc/_extensions/backports.py | 1,735 | Python |
#!/usr/bin/env python3
import RPi.GPIO as GPIO
import time
import threading
import logging
import pandas as pd
import numpy as np
from tzlocal import get_localzone
from flask import Flask, render_template, url_for, request
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(threadName)... | 27.886792 | 99 | 0.58525 | [
"MIT"
] | wbkang/rpi-repo | rpiweather/server.py | 4,434 | Python |
# -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2019/10/30 11:28
Desc: 新浪财经-A股-实时行情数据和历史行情数据(包含前复权和后复权因子)
"""
import re
import demjson
import execjs
import pandas as pd
import requests
from tqdm import tqdm
from akshare.stock.cons import (zh_sina_a_stock_payload,
zh_sina_a_stock... | 44.979695 | 107 | 0.586616 | [
"MIT"
] | fellowfun/akshare | akshare/stock/zh_stock_a_sina.py | 9,239 | Python |
"""Support for HomematicIP Cloud lights."""
import logging
from typing import Any, Dict
from homematicip.aio.device import (
AsyncBrandDimmer,
AsyncBrandSwitchMeasuring,
AsyncBrandSwitchNotificationLight,
AsyncDimmer,
AsyncFullFlushDimmer,
AsyncPluggableDimmer,
)
from homematicip.base.enums imp... | 32.391459 | 88 | 0.652054 | [
"Apache-2.0"
] | 0x00-0xFF/home-assistant | homeassistant/components/homematicip_cloud/light.py | 9,102 | Python |
# region [Imports]
# * Standard Library Imports ---------------------------------------------------------------------------->
import os
import logging
import sqlite3 as sqlite
from pprint import pformat
# * Gid Imports ----------------------------------------------------------------------------------------->
import g... | 26.624 | 106 | 0.578425 | [
"MIT"
] | official-antistasi-community/Antipetros_Discord_Bot | antipetros_discordbot/utility/gidsql/db_action_base.py | 3,328 | Python |
# Copyright (c) 2020, Fabio Muratore, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source ... | 40.965142 | 120 | 0.625725 | [
"MIT"
] | nifunk/GNNMushroomRL | mushroom_rl/core/parallelization_tools/step_sequence.py | 37,606 | Python |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask_caching import Cache
from flask_caching.backends.rediscache import RedisCache
from flask_cachin... | 31.971963 | 83 | 0.653464 | [
"MIT"
] | errikos/indico | indico/core/cache.py | 6,842 | Python |
import numpy as np # linear algebra
np.random.seed(42)
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from sklearn.model_selection import train_test_split
from matplotlib import pyplot
import time
import os, glob
import cv2
# parameters
format = "%H%M"
ts = time.strftime(format)
base_name = os.... | 35.669683 | 117 | 0.571356 | [
"MIT"
] | OsciiArt/Cookpad | train_180131_2.py | 15,766 | Python |
import logging
import numpy as np
from cvlib.object_detection import populate_class_labels, draw_bbox, detect_common_objects
from traffic_monitor.services.detectors.detector_abstract import DetectorAbstract
logger = logging.getLogger('detector')
class DetectorCVlib(DetectorAbstract):
"""
Implementation of ... | 41.457627 | 125 | 0.674571 | [
"MIT"
] | mcdomx/monitor | traffic_monitor/services/detectors/detector_cvlib.py | 2,446 | Python |
import os
import json
import datetime
import numpy as np
from matplotlib import pyplot as plt
class MetaLogger(object):
def __init__(self, meta_config, config, task_directory, load_directory=None, load_epoch=None):
self.results_directory = os.path.join('meta_results', str(datetime.datetime.now()))
... | 41.897727 | 155 | 0.606184 | [
"MIT"
] | rlaboulaye/transformer | meta_logger.py | 3,687 | Python |
import torch.nn.functional as F
from torch import nn
from torchvision.ops import MultiScaleRoIAlign
from ..._internally_replaced_utils import load_state_dict_from_url
from ...ops import misc as misc_nn_ops
from ..mobilenetv3 import mobilenet_v3_large
from ..resnet import resnet50
from ._utils import overwrite_eps
from... | 44.154426 | 139 | 0.66425 | [
"BSD-3-Clause"
] | Bethhhh/vision | torchvision/models/detection/faster_rcnn.py | 23,446 | Python |
# @Author: Pieter Blok
# @Date: 2021-03-25 15:33:17
# @Last Modified by: Pieter Blok
# @Last Modified time: 2021-03-25 15:36:30
from .uncertainty import * | 26.5 | 42 | 0.685535 | [
"Apache-2.0"
] | bpanahij/maskal | active_learning/heuristics/__init__.py | 159 | Python |
#!/usr/bin/env python
"""Tests for the export mechanisms of tulip.dumpsmach."""
from __future__ import print_function
import logging
import networkx as nx
from nose.tools import assert_raises
from tulip import spec, synth, dumpsmach
logging.getLogger('tulip').setLevel('ERROR')
logging.getLogger('astutils').setLeve... | 32.46988 | 83 | 0.547681 | [
"BSD-3-Clause"
] | arw12625/tulip-control | tests/dumpsmach_test.py | 2,695 | Python |
# coding=utf-8
import requests
import json
def robot(content,userid):
api = r'http://openapi.tuling123.com/openapi/api/v2'
data = {
"perception": {
"inputText": {
"text": content
}
},
"userInfo": {
"a... | 26.590909 | 65 | 0.499145 | [
"MIT"
] | 91MrGeng/wechatrobot | tuling.py | 585 | Python |
import argparse
import os
import sys
import numpy as np
import soundfile
from mir_eval.util import midi_to_hz
from onsets_and_frames import *
def load_and_process_audio(flac_path, sequence_length, device):
random = np.random.RandomState(seed=42)
audio, sr = soundfile.read(flac_path, dtype='int16')
ass... | 34.733333 | 146 | 0.680742 | [
"MIT"
] | RKelln/onsets-and-frames | transcribe.py | 3,126 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script. Based on Jeff Knupp's Demo + Cookiecutter"""
import io
import os
from setuptools import setup, find_packages
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filenam... | 27.4 | 67 | 0.654197 | [
"MIT"
] | GenusGeoff/tiingo-python | setup.py | 2,192 | Python |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/models/models.ccpm.ipynb (unless otherwise specified).
__all__ = ['CCPM']
# Cell
import torch
from torch import nn
from .layers.embedding import EmbeddingLayer
from .layers.common import KMaxPooling
from .bases.ctr import CTRModel
# Internal Cell
def get_activation(a... | 40.382979 | 102 | 0.58667 | [
"Apache-2.0"
] | RecoHut-Projects/recohut | _docs/py/models/ccpm.py | 3,796 | Python |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU'])
Monomer('SmacM', ['BaxA'])
Monomer('BaxM', ['BidM', 'BaxA'])
M... | 87.857923 | 710 | 0.803458 | [
"MIT"
] | LoLab-VU/Bayesian_Inference_of_Network_Dynamics | log_mito/model_112.py | 16,078 | Python |
# Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM 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
#
# Unless requir... | 36.88172 | 79 | 0.680466 | [
"Apache-2.0"
] | PFZheng/nova | nova/api/openstack/compute/plugins/v3/pause_server.py | 3,430 | Python |
# coding=utf-8
import websocket
import datetime
import csv
import time
import logging
import redis
import json
import copy
import pytz
from hftcoin.mdagent.ccws.configs import REDIS_HOST
from hftcoin.mdagent.ccws.configs import TIMEZONE
from hftcoin.mdagent.ccws.configs import ExConfigs
from hftcoin.mdagent.ccws.confi... | 32.631285 | 103 | 0.546995 | [
"MIT"
] | applezjm/testsub | ccws/base.py | 5,841 | Python |
import json
import os
import re
import sys
import sysconfig
RX_VERSION = re.compile(r"\d\.\d")
INSIGHTS = {
"_gdbm": "_GDBM_VERSION",
"_tkinter": "TCL_VERSION TK_VERSION",
"_sqlite3": "sqlite_version version",
"_ssl": "OPENSSL_VERSION",
"dbm.gnu": "_GDBM_VERSION",
"ensurepip": "_PIP_VERSION",
... | 27.536 | 102 | 0.613597 | [
"MIT"
] | codrsquad/portable-python | src/portable_python/external/_inspect.py | 3,442 | Python |
# Copyright 2013-2022 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 RRrblup(RPackage):
"""Ridge Regression and Other Kernels for Genomic Selection.
Softw... | 36.75 | 95 | 0.756236 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | FJ-NaokiMatsumura/spack | var/spack/repos/builtin/packages/r-rrblup/package.py | 882 | 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
# d... | 37.192593 | 78 | 0.671779 | [
"Apache-2.0"
] | JerryDog/horizon-f-road | openstack-dashboard/openstack_dashboard/test/integration_tests/basewebobject.py | 5,021 | Python |
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
# import deepspeed
# import mpi4py
# import pandas
import torch
import transformers
import wandb
#%env WANDB_PROJECT=wine_gpt2_Trainer_42
MODEL_NAME = "gpt2-medium"
# wandb.login(anonymous='never', key="222a37baaf0c1b0d1499ec003e5c2fe49f97b107")
wandb.init()
# wan... | 26.433962 | 98 | 0.732691 | [
"Apache-2.0"
] | cipher982/Wine-o-matic | extra_code/transformers-gpt2-finetune.py | 2,802 | Python |
import time
from django.db import connections
from django.db.utils import OperationalError
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""Django command to pause execution until database is available """
def handle(self, *args, **options):
self.stdout.write('Waitin... | 35.210526 | 78 | 0.654709 | [
"MIT"
] | nagarjunand/receipe-app-api | app/core/management/commands/wait_for_db.py | 669 | Python |
from .base import * # noqa pylint: disable=wildcard-import, unused-wildcard-import
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
SECRET_KEY = env("DJANGO_SECRET_KEY")
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["coronacircles.de"])
# DA... | 37.496732 | 87 | 0.569984 | [
"MIT"
] | CoronaCircle/coronacircles | settings/production.py | 5,737 | Python |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 27.471023 | 108 | 0.586786 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 312day/airflow | setup.py | 22,279 | Python |
#!/usr/bin/env python
# Copyright 2020 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 36.208459 | 80 | 0.617063 | [
"Apache-2.0"
] | isabella232/pigweed | pw_watch/py/pw_watch/watch.py | 24,653 | Python |
import os
import string
import textwrap
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging
#
# DMRIInstall
#
class DMRIInstall(ScriptedLoadableModule):
"""
"""
helpText = textwrap.dedent(
"""
The SlicerDMRI extension provides diffusion-related tools inclu... | 30.539063 | 97 | 0.712714 | [
"Apache-2.0"
] | forfullstack/slicersources-src | Modules/Scripted/DMRIInstall/DMRIInstall.py | 3,909 | Python |
from django.shortcuts import render,HttpResponse
from game.models import Contact
from django.contrib import messages
# Create your views here.
def index(request):
context={'variable':"This is sent."}
return render(request,'index.html',context)
def about(request):
return render(request,'about.html'... | 40.8 | 94 | 0.697059 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | whitedevil4888/riddhisiddhi | views.py | 1,020 | Python |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import account_config_settings
import account_move
import account_partial_reconcile
import account_tax
import res_company
| 24.666667 | 74 | 0.815315 | [
"Apache-2.0"
] | gtfarng/Odoo_migrade | apps/odoo/lib/odoo-10.0.post20170615-py2.7.egg/odoo/addons/account_tax_cash_basis/models/__init__.py | 222 | Python |
# import libraries
from pyspark.sql import SparkSession
from pyspark import SparkConf
from pyspark.sql.types import *
from pyspark.sql.functions import col, count, lit, rand, when
import pandas as pd
from math import ceil
#################################################
# spark config
##############################... | 44.221289 | 142 | 0.668905 | [
"MIT"
] | poltextlab/nyt_hybrid_classification_workflow | spark_cluster/04_2_HV_basic/HV_v1_NYT_sim1_and_sim3_to_sim2/6200_ML2_HV_v1_NYT_sim1_and_sim3_to_sim2_round5_human_validation.py | 15,787 | Python |
"""Extra types understood by apitools.
This file will be replaced by a .proto file when we switch to proto2
from protorpc.
"""
import collections
import json
import numbers
from protorpc import message_types
from protorpc import messages
from protorpc import protojson
from apitools.base.py import encoding
from apit... | 30.577586 | 78 | 0.762193 | [
"Apache-2.0"
] | Technology-Hatchery/google-cloud-sdk | .install/.backup/lib/apitools/base/py/extra_types.py | 7,094 | Python |
import json
import numpy as np
from PIL import Image
def load_json(f):
with open(f, 'r') as fp:
return json.load(fp)
def save_json(obj, f, ensure_ascii=True, indent=None):
with open(f, 'w') as fp:
json.dump(obj, fp, ensure_ascii=ensure_ascii, indent=indent)
def load_image(f, mode='RGB'):
... | 19.9 | 68 | 0.658291 | [
"MIT"
] | narumiruna/labelme-utils | labelmeutils/utils/io.py | 398 | Python |
#!/usr/bin/python3
import click
import os
import tempfile
import filecmp
import shutil
import difflib
import sys
import git
import shell_utils
SOURCE_EXTENSIONS = [".cpp", ".c", ".cxx", ".cc", ".h", ".hxx", ".hpp"]
class Colors:
HEADER = '\033[95m'
BLUE = '\033[94m'
CYAN = '\033[96m'
GREEN = '\033... | 37.02381 | 120 | 0.629582 | [
"MIT"
] | markcutler/autopilot | tools/run_clang_format.py | 4,665 | Python |
#filling 2nd form and validating ans
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver=webdriver.Chrome("../chromedriver.exe")
driver.get("https://www.seleniumeasy.com/test/basic-first-form-demo.html")
num1=2
num2=3
element1=driver.find_element(By.ID,"sum1").s... | 23.266667 | 102 | 0.7149 | [
"MIT"
] | araj29011998/Complete-Selenium-Automation | selenium/filling form/form-2.py | 698 | Python |
from collections import OrderedDict
from sympy import Basic, true
from devito.tools import as_tuple, is_integer, memoized_meth
from devito.types import Dimension
__all__ = ['Vector', 'LabeledVector', 'vmin', 'vmax']
class Vector(tuple):
"""
A representation of an object in Z^n.
The elements of a Vect... | 34.409471 | 87 | 0.567393 | [
"MIT"
] | rhodrin/devito | devito/ir/support/vector.py | 12,353 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from threathunter_common.geo.phonelocator import *
__author__ = "nebula"
def test_phone():
print check_phone_number("+13482345020", None)
assert check_phone_number("13482345020", 'CN')
assert not check_phone_number("+134823450", None)
print get_carrier("... | 24.225806 | 53 | 0.679095 | [
"Apache-2.0"
] | threathunterX/python_lib | threathunter_common_python/test/testphone.py | 751 | Python |
"""
Output formats.
"""
from .rst import RST
from .console import Console
from .json import JSON
from .svg import SVG
from .png import PNG
| 14 | 28 | 0.735714 | [
"MIT"
] | sebMathieu/code_metrics | metrics/outputs/__init__.py | 140 | Python |
#!/usr/bin/env python3
"""Pre-commit hook to verify that all extras are documented in README.rst"""
import configparser
import re
from pathlib import Path
repo_dir = Path(__file__).parent.parent.parent
config = configparser.ConfigParser(strict=False)
config.read(repo_dir / "setup.cfg")
all_extra = []
extra_to_exclud... | 24.265306 | 76 | 0.666947 | [
"Apache-2.0"
] | astronomer/astronomer-providers | .circleci/scripts/pre_commit_readme_extra.py | 1,189 | Python |
#!/usr/bin/env python
from setuptools import setup, find_packages
import versioneer
setup(
name="q2-autopepsirf",
version=versioneer.get_version(),
cmdclass = versioneer.get_cmdclass(),
packages = find_packages(),
package_data={},
author="Annabelle Brown",
author_email="annabel... | 28.904762 | 80 | 0.672158 | [
"Apache-2.0"
] | Annabelle-Brown/q2-autopepsirf | setup.py | 607 | Python |
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from lda import LDA
def learn_topics(texts, topicnum):
# Get vocabulary and word counts. Use the top 10,000 most frequent
# lowercase unigrams with at least 3 alphabetical, non-numeric characters,
# punctuation treate... | 34.514286 | 84 | 0.701987 | [
"MIT"
] | mikepackard415/Scientific-Environmental-Discourse | Programs/env_lda.py | 1,208 | Python |
import os
import glob
import psycopg2
import pandas as pd
import numpy as np
from sql_queries import *
def process_song_file(cur, filepath):
# open song file
df = pd.read_json(filepath, lines = True)
# insert song record
song_data = df[["song_id", "title", "artist_id", "year", "duration"]].values[0]
... | 32.40625 | 119 | 0.641916 | [
"MIT"
] | cdiswine/data-engineering-nanodegree | ETL-data-with-postgres/etl.py | 3,111 | Python |
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from setuptools import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['soccer_trajectories'],
package_dir={'': 'src'},
)
setup(**setup_args)
| 24.230769 | 61 | 0.768254 | [
"BSD-3-Clause"
] | sadmanca/soccerbot | soccer_trajectories/setup.py | 315 | Python |
# Copyright 2021 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 to... | 44.461538 | 103 | 0.645329 | [
"Apache-2.0"
] | 233-puchi/mindspore | model_zoo/official/gnn/gat/preprocess.py | 2,312 | Python |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'birdview.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtG... | 43.5 | 75 | 0.71798 | [
"BSD-3-Clause"
] | AndyYangjd/data_fuse_demo | src/visualization_simulator/src/ui/ui_birdview.py | 2,436 | Python |
from django.utils import timezone
from maestros.models import Unidades
from maestros_generales.models import Empresas
__author__ = 'julian'
from django.contrib.gis.db import models
import datetime
class WaspTypeSensor(models.Model):
name = models.CharField(max_length=50)
units = models.... | 45.568627 | 121 | 0.671687 | [
"BSD-3-Clause"
] | Infinityloopsistemas/SIVA | rest_waspmote/models.py | 2,324 | Python |
"""Test length measured in half bytes (nibbles). Nibbles were added in v2.1"""
import copy
import iso8583
import iso8583.specs
import pytest
# fmt: off
@pytest.mark.parametrize(
["data_enc", "len_enc", "len_type", "max_len", "len_count", "result", "result_f2_len"],
[
("ascii", "ascii", 2, 8, "bytes"... | 35.397917 | 98 | 0.571126 | [
"MIT"
] | knovichikhin/pyiso8583 | tests/test_nibbles.py | 16,991 | Python |
import argparse
import os, sys
import os.path as osp
import torchvision
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms
import network, loss
from torch.utils.data import DataLoader
import random, pdb, math, copy
from tqdm import tqdm
from scipy.spatia... | 40.820106 | 126 | 0.61024 | [
"MIT"
] | viniciusarruda/SHOT | experiments/digit/unsupervised_digit_inspect.py | 7,716 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, SIS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Encuesta(Document):
pass
| 22.545455 | 49 | 0.774194 | [
"MIT"
] | ErickLopez76/encuestaapp | encuestaapp/encuestaapp/doctype/encuesta/encuesta.py | 248 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.