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 |
|---|---|---|---|---|---|---|---|---|
import numpy as np
import scipy.stats as scst
import scipy.special as scsp
import scipy.optimize as scopt
import tensorflow as tf
import tensorflow_probability as tfp
import pickle
import os
import sys
try:
import gpflow
except:
raise Exception("Requires gpflow!")
import utils
def fit_gp(
X,
Y,
... | 29.751708 | 131 | 0.497741 | [
"MIT"
] | qphong/BayesOpt-LV | functions.py | 26,122 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np
from ..pipelineState import PipelineStateInterface
from ..data import BrewPipeDataFrame
__author__ = 'Dominik Meyer <meyerd@mytum.de>'
class NumpyNullPreprocessor(PipelineStateInterface):
"""
This is an example class of preprocessor,... | 31.837838 | 83 | 0.578947 | [
"Apache-2.0"
] | meyerd/brewPipe | brewPipe/preprocess/numpy_null.py | 2,356 | Python |
# -*- coding: utf-8 -*-
"""
mslib.msui._tests.test_mscolab_project
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is used to test mscolab-project related gui.
This file is part of mss.
:copyright: Copyright 2019 Shivashis Padhi
:copyright: Copyright 2019-2021 by the mss team, see AUTHORS... | 42.12069 | 102 | 0.693546 | [
"Apache-2.0"
] | withoutwaxaryan/MSS | mslib/msui/_tests/test_mscolab_project.py | 7,329 | Python |
#!/usr/bin/python
# this script will update the versions in packages and innosetup installer files to match that in config.h
import plistlib, os, datetime, fileinput, glob, sys, string
scriptpath = os.path.dirname(os.path.realpath(__file__))
projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir))
IPLUG2_R... | 33.362637 | 120 | 0.669631 | [
"MIT"
] | Bindernews/BigLittleGain | BigLittleGain/scripts/update_installer_version.py | 3,036 | Python |
#
# A general spatial method class
#
import pybamm
import numpy as np
from scipy.sparse import eye, kron, coo_matrix, csr_matrix
class SpatialMethod:
"""
A general spatial methods class, with default (trivial) behaviour for some spatial
operations.
All spatial methods will follow the general form of S... | 35.042607 | 88 | 0.609355 | [
"BSD-3-Clause"
] | jedgedrudd/PyBaMM | pybamm/spatial_methods/spatial_method.py | 13,982 | Python |
import os
import numpy as np
def save_gif(gif_fname, images, fps):
"""
To generate a gif from image files, first generate palette from images
and then generate the gif from the images and the palette.
ffmpeg -i input_%02d.jpg -vf palettegen -y palette.png
ffmpeg -i input_%02d.jpg -i palette.png -... | 33.023256 | 111 | 0.565493 | [
"MIT"
] | Bonennult/video_prediction | video_prediction/utils/ffmpeg_gif.py | 2,840 | Python |
# -*- coding: utf-8 -*-
import datetime
import json
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
class DBEngine(object):
def __init__(self, db_uri):
"""
db_uri = f'mysql+pymysql://{username}:{password}@{host}:{port}/{database}?charset=utf8mb4'
"""
... | 31.772152 | 98 | 0.556574 | [
"Apache-2.0"
] | AlanFightting/httprunner | httprunner/database/engine.py | 2,510 | 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 *
import glob
import sys
class Binutils(AutotoolsPackage, GNUMirrorPackage):
"""GNU binutils, whic... | 42.946565 | 96 | 0.658194 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 0t1s1/spack | var/spack/repos/builtin/packages/binutils/package.py | 5,626 | Python |
#
# Copyright (c) 2021 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 30.656904 | 137 | 0.733179 | [
"Apache-2.0"
] | guardicore/nitro-python | build/lib/nssrc/com/citrix/netscaler/nitro/resource/config/vpn/vpnvserver_vpnnexthopserver_binding.py | 7,327 | Python |
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.setWindowTitle('加载外部网页的例子')
self.setGeometry(5,30,1355,730)
... | 28.666667 | 66 | 0.684385 | [
"MIT"
] | Skylark0924/Vocabulary_Analysis | ui/textUI.py | 634 | Python |
import csv
import json
import random
import re
import socket
import string
import tempfile
from base64 import b64decode, b64encode
from pathlib import Path
import ipaddress
from subprocess import check_output, CalledProcessError, TimeoutExpired
from yaml import safe_load
from charmhelpers.core import hookenv
from char... | 35.80303 | 96 | 0.63394 | [
"ECL-2.0",
"Apache-2.0"
] | hemanthnakkina/charm-kubernetes-master | lib/charms/layer/kubernetes_master.py | 16,541 | Python |
# -*- coding:utf-8 -*-
"""
some constants and global queues
Author: QiaoXiaofeng
Date: 2020/01/11
Email: andyjoe318@gmail.com
"""
from collections import deque
# Version
VERSION = "1.1.3_201123_alpha"
# Exchange Names
HUOBI_SWAP = "huobi_swap" # Huobi Swap https://huobiapi.github.io/docs/coin_margined_swap/v1/... | 23.655172 | 98 | 0.749271 | [
"MIT"
] | Jscorpio1611/huobi_futures_Python | alpha/const.py | 686 | Python |
#!/usr/bin/python
import requests
import json
import cv2
import time
import logging
import random
ledServerURL = 'http://192.168.1.51'
nbPixels = 30
def getServerPath(url):
return "%s%s" % (ledServerURL, url)
def getImage():
retval, im = camera.read()
return im
def getWarmUpImage():
# Warmup
for i in range... | 24.159574 | 85 | 0.690004 | [
"MIT"
] | kalemena/no-hell-lights | src/opencv-match-pixels.py | 2,271 | 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... | 39.742424 | 114 | 0.62662 | [
"Apache-2.0"
] | Esail/tensorflow | tensorflow/contrib/data/python/kernel_tests/window_dataset_op_test.py | 20,984 | Python |
"""
Data Structures shared by both the detectors and the server
"""
import datetime
import sys
import traceback
from typing import *
from dataclasses import dataclass, field
from dataclasses_jsonschema import JsonSchemaMixin
@dataclass
class ConfigMessage(JsonSchemaMixin):
cat_identifiers: Dict[str, str] # servi... | 23.487179 | 79 | 0.730349 | [
"MIT"
] | jsexauer/kitbit | src/kitbit/protocol.py | 916 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Utils for generating stats from torch tensors.
"""
from typing import Iterator, List, Tuple, Union
import numpy as np
import torch
from torch.functional import F
def calc_sample_norms(
named_params: Iterator[Tuple[s... | 34.709459 | 103 | 0.625268 | [
"MIT"
] | DaveBrind/SynthVAE | opacus/utils/tensor_utils.py | 5,137 | Python |
import dynamo as dyn
import numpy as np
import scipy.io
from scipy import optimize
# def VecFnc(
# input,
# n=4,
# a1=10.0,
# a2=10.0,
# Kdxx=4,
# Kdyx=4,
# Kdyy=4,
# Kdxy=4,
# b1=10.0,
# b2=10.0,
# k1=1.0,
# k2=1.0,
# c1=0,
# ):
# x, y = input
# dxdt = (
# ... | 27.744966 | 136 | 0.497823 | [
"BSD-3-Clause"
] | aanaseer/dynamo-release | tests/tests.py | 8,270 | Python |
import tensorflow as tf
from dataflow.generator_cls import GeneratorCLS
import json
import logging
from easydict import EasyDict
from dataflow.utils import fix_rng_seed
from model.util import batched_gather
import os
import pickle
def get_lr_schedule(lr_schedule):
boundaries = lr_schedule.boundaries
values = lr_sc... | 38.173077 | 108 | 0.685139 | [
"Apache-2.0"
] | haamoon/finding_common_object | utils.py | 3,970 | Python |
# -*- coding: utf-8 -*-
import datetime
fhVpiKRlyhgsBUpbOQysWaBffABPdeSUqbNQWzpsBmbkqxlCYtAxtWnCcwMifMeIoIiHPsGbUcWRqPYTNEboepPIAKGlrzHEoVTYYeXuBlbUOBrizEBUQHwXbVjOZgnp = 'dmhqfXZEWScpGcCscOLcRkUgRMpmnavpmEzKbcQdDFhUmHjneIBOrLglmFqWAtOtbaswRpZpKSnZlZzlfTbviGHZDbgxVbrqgEEbclXGVksOMdAjGakzUHDiaPRBOHsl'
dwBjbvwPMXdXoHFSDB... | 233.294372 | 286 | 0.937819 | [
"MIT"
] | CrackerCat/Intensio-Obfuscator | intensio/test/python/multiplefiles/advanced/output/basicRAT/core/toolkit.py | 53,891 | Python |
#!/usr/bin/python
from base64 import standard_b64encode
from crc32c import crc32
from datetime import datetime
from google.cloud import storage
from os.path import basename, dirname, isfile
from os import makedirs, getenv
from glob import glob
from time import sleep
import json
import petname
import subprocess
import ... | 28.530055 | 87 | 0.610419 | [
"Apache-2.0"
] | Chicoryn/dream-go | contrib/distr-env/dg_storage.py | 5,221 | Python |
import jwt
import pendulum
from ..routes import Route
from .controllers import AuthenticationController
from ..utils.str import random_string
class Api:
def __init__(self, application, driver_config=None):
self.application = application
def set_configuration(self, config):
self.config = confi... | 31.444444 | 117 | 0.605525 | [
"MIT"
] | josephmancuso/masonite | src/masonite/api/Api.py | 3,113 | Python |
"""pubsub 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-bas... | 34.592593 | 79 | 0.700214 | [
"BSD-3-Clause"
] | whs/pubsub | pubsub/urls.py | 934 | Python |
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template file: justice_py_sdk_codegen/__main__.py
# Justice Matchmaking Service (2.15.1)
# pylint: dis... | 36.461111 | 193 | 0.62959 | [
"MIT"
] | AccelByte/accelbyte-python-sdk | accelbyte_py_sdk/api/matchmaking/models/models_update_alliance_rule.py | 6,563 | Python |
from enum import Enum
# TODO-01 Define Error Type or Exception cbchoi
Infinite = float("inf") # hug value
class AttributeType(Enum):
# BEHAVIOR = 0
ASPECT = 1
RUNTIME = 2
UNKNOWN_TYPE = -1
@staticmethod
def resolve_type_from_str(name):
# if "BEHAVIOR" == name.upper():
# r... | 26.362745 | 95 | 0.633693 | [
"MIT"
] | JeHyuckLee/evsim | definition.py | 2,689 | Python |
import turtle
'''fix'''
def draw_rhombus(some_turtle):
for i in range(1,3):
some_turtle.forward(20)
some_turtle.right(315)
some_turtle.forward(20)
some_turtle.right(225)
def draw_ribbon(some_turtle):
some_turtle.forward(100)
some_turtle.right(150)
some_turtle.forward(30)... | 21.313725 | 33 | 0.649494 | [
"Apache-2.0"
] | shmiko/big-fat-python-tests | basic/draw_drawing.py | 1,087 | Python |
__version__ = '0.2.1'
__author__ = 'Lindsey Heagy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2018-2019 Lindsey Heagy'
| 26 | 51 | 0.707692 | [
"MIT"
] | lheagy/casingResearch | casingSimulations/info.py | 130 | Python |
import requests
class Sympla(object):
_URL = "https://api.sympla.com.br/public/v3/"
def __init__(self, token):
self.__token = token
def _get_url(self, path: str) -> str:
return f"{self._URL}{path}"
@property
def headers(self) -> dict:
return {"S_TOKEN": self.__token}
... | 33.588235 | 236 | 0.612181 | [
"MIT"
] | hudsonbrendon/pysympla | pysympla/sympla.py | 10,326 | Python |
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
browser = webdriver.Chrome("./driver/chromedriver.exe")
options = Options()
#options.headless = True
browser = webdriver.Chrome(executable_path="./driver/chromedriver.exe", options=options)
browser.get("https://center-pf.kakao.com/") | 35.555556 | 88 | 0.790625 | [
"MIT"
] | seraph92/win32_test | old/browser_auto.py | 320 | Python |
import numpy as np
from numpy.testing import assert_allclose
from scipy.stats import norm
from astroML.density_estimation import\
EmpiricalDistribution, FunctionDistribution
def test_empirical_distribution(N=1000, rseed=0):
np.random.seed(rseed)
X = norm.rvs(0, 1, size=N)
dist = EmpiricalDistribution(... | 24.085714 | 72 | 0.661922 | [
"BSD-2-Clause"
] | DinoBektesevic/astroML | astroML/density_estimation/tests/test_empirical.py | 843 | Python |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import numpy as np
from parlai.core.torch_generator_agent impor... | 33.494118 | 87 | 0.610166 | [
"MIT"
] | jinjiren/ParlAI | parlai/agents/transformer/modules.py | 19,929 | Python |
##
## © Copyright 2021- IBM Inc. All rights reserved
# SPDX-License-Identifier: MIT
##
#
# This code has two use-cases:
# 1. Where you want to run a batch of queries, with each saving results in CSV - specify the TestId this is added to make filename))
# 2. When you want to run a series of queries and check the data ... | 44.220779 | 213 | 0.575428 | [
"MIT"
] | IBM/ELM-OSLC-Query | elmclient/examples/batchquery.py | 10,216 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 49.034014 | 209 | 0.679014 | [
"MIT"
] | Co0olboi/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/operations/_express_route_gateways_operations.py | 21,624 | Python |
from django.conf.urls.defaults import *
urlpatterns = patterns("corehq.apps.ivr.views",
)
| 15.333333 | 47 | 0.75 | [
"BSD-3-Clause"
] | SEL-Columbia/commcare-hq | corehq/apps/ivr/urls.py | 92 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-25 21:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('images', '0006_auto_20180125_2142'),
]
operations = [
migrations.AlterModelOptions(... | 20.75 | 50 | 0.612048 | [
"MIT"
] | kelly-rose/kellygram | kellygram/images/migrations/0007_auto_20180125_2143.py | 415 | Python |
from typing import Optional
from great_expectations.core import ExpectationConfiguration
from great_expectations.expectations.expectation import MulticolumnMapExpectation
from great_expectations.expectations.util import (
add_values_with_json_schema_from_list_in_params,
render_evaluation_parameter_string,
)
fr... | 35.071429 | 118 | 0.577339 | [
"Apache-2.0"
] | MeganBeckett/great_expectations | great_expectations/expectations/core/expect_select_column_values_to_be_unique_within_record.py | 9,329 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import subprocess
import time
import web
from web import form,timelimit
import hashlib
import datetime
import random
from func_recall import risk_recall
_tmpstring = "".join(random.sample('zyxwvutsrqponmlkjihgfedcba',20))
urls = (
'/', 'Login',
... | 43.712598 | 124 | 0.587319 | [
"MIT"
] | wqwangchn/novice | pynovice/tmp_classification/web_py/web_moniter.py | 11,357 | Python |
"""
Pymodbus Exceptions
--------------------
Custom exceptions to be used in the Modbus code.
"""
class ModbusException(Exception):
""" Base modbus exception """
def __init__(self, string):
""" Initialize the exception
:param string: The message to append to the error
"""
sel... | 28.042017 | 79 | 0.614324 | [
"BSD-3-Clause"
] | Biondoap/pymodbus | pymodbus/exceptions.py | 3,337 | Python |
from typing_extensions import Literal
from pydantic import BaseModel
class GroupIncreaseEvent(BaseModel):
group_id: int
notice_type = "group_increase"
operator_id: int
post_type = "notice"
self_id: int
sub_type: Literal["approve"]
time: int
user_id: int
class Config:
arbit... | 20.352941 | 38 | 0.708092 | [
"MIT"
] | SSmJaE/PepperBot | pepperbot/models/events/GroupIncrease.py | 346 | Python |
'''
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the ... | 16.425 | 85 | 0.601218 | [
"MIT"
] | malienko/projecteuler_python | problem25.py | 661 | Python |
import requests
#Using an API to search for COVID Movies
url = 'http://www.omdbapi.com/?t=covid&y=2021&apikey=d0c69d2c'
r = requests.get(url)
json_data = r.json()
for key, value in json_data.items():
print(key + ':', value) | 31.857143 | 62 | 0.717489 | [
"MIT"
] | clearyb1/COVIDDataViz | analysis/OMDBAPI.py | 223 | Python |
from __future__ import absolute_import
from django.contrib import admin
from . import models
admin.site.register(models.ExampleModel)
admin.site.register(models.ExampleNonUploadModel)
| 20.777778 | 49 | 0.84492 | [
"BSD-3-Clause"
] | 4nzor/django-ckeditor | ckeditor_demo/demo_application/admin.py | 187 | Python |
# -----------------------------------------------------------------------------------
# <copyright company="Aspose" file="test_file.py">
# Copyright (c) 2020 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and assoc... | 41.783784 | 209 | 0.693834 | [
"MIT"
] | rizwanniazigroupdocs/aspose-words-cloud-python | test/api/storage/test_file.py | 4,638 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 43.272727 | 126 | 0.690943 | [
"MIT"
] | changlong-liu/autorest.python | docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py | 4,284 | Python |
# coding=utf-8
# =============================================================================
# Copyright (c) 2001-2019 FLIR Systems, Inc. All Rights Reserved.
#
# This software is the confidential and proprietary information of FLIR
# Integrated Imaging Solutions, Inc. ("Confidential Information"). You
# shall not di... | 38.278846 | 144 | 0.64627 | [
"MIT"
] | BevanLab/Recording_Script | Sample/spinnaker_python-2.2.0.48-cp37-cp37m-win_amd64/Examples/Python3/Trigger.py | 19,905 | Python |
from .hw_6_check import has_plotting
def test_nothing():
assert not has_plotting("")
def test_plotly():
assert has_plotting("import plotly.express as px")
def test_plot_method():
assert has_plotting("df.plot()")
def test_plot_submodule():
assert has_plotting("df.plot.scatter()")
| 16.888889 | 54 | 0.720395 | [
"CC0-1.0"
] | MatthewMaury/python-public-policy | extras/scripts/test_hw_6_check.py | 304 | Python |
import json
from unittest.mock import patch
from django.core import mail
from hc.api.models import Channel, Notification
from hc.test import BaseTestCase
class SendTestNotificationTestCase(BaseTestCase):
def setUp(self):
super(SendTestNotificationTestCase, self).setUp()
self.channel = Channel(kin... | 35.414414 | 78 | 0.610023 | [
"BSD-3-Clause"
] | UniversitaDellaCalabria/healthchecks | hc/front/tests/test_send_test_notification.py | 3,931 | Python |
# Copyright 2020 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... | 45.883802 | 97 | 0.716559 | [
"Apache-2.0"
] | AvikantSrivastava/models | research/object_detection/meta_architectures/center_net_meta_arch.py | 145,314 | Python |
#!/opt/local/bin/python
import timeit
import time
import sys
def find_score(name):
score = 0
for character in name:
score += ( ord(character) - 64 )
return score
start_time = timeit.default_timer()
total = 0
cardinal_position = 0
import csv
with open('p022_names.txt', newline='') as csvfile:
... | 25.892857 | 89 | 0.642759 | [
"Artistic-2.0"
] | perlygatekeeper/glowing-robot | Project_Euler/22_name_scores/name_scores.py | 725 | Python |
from dataclasses import dataclass
from running_modes.configurations.automated_curriculum_learning.merging_strategy_configuration import \
MergingStrategyConfiguration
from running_modes.configurations.automated_curriculum_learning.production_strategy_configuration import \
ProductionStrategyConfiguration
from ... | 39.826087 | 106 | 0.868996 | [
"Apache-2.0"
] | argentumgun/Reinvent | running_modes/configurations/automated_curriculum_learning/automated_curriculum_learning_configuration.py | 916 | Python |
import sys
from kubernetes import client, config
def main():
currNameSpace=sys.argv[1]
config.load_incluster_config()
v1 = client.CoreV1Api()
nodeList = v1.list_pod_for_all_namespaces(watch=False)
for node in nodeList.items:
if node.metadata.namespace == currNameSpace:
print(("... | 24.428571 | 71 | 0.654971 | [
"Apache-2.0"
] | AnithaKuberan/testrunner | cloudtest/support/getNodeIps.py | 513 | Python |
# from .LinuxInstaller import LinuxInstaller
from .run import run
from .solution import *
from .installer import *
from .controller import *
from .errors import *
from .helper.configuration import ConfVar
from . import helper
from . import builder
| 24.8 | 44 | 0.790323 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | QuailInstaller/Quail | iquail/__init__.py | 248 | Python |
#!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 appli... | 35.163655 | 119 | 0.608115 | [
"Apache-2.0"
] | Acidburn0zzz/test-infra | jenkins/bootstrap.py | 35,023 | Python |
# pylint: disable=W0231,E1101
import collections
from datetime import timedelta
import functools
import gc
import json
import operator
from textwrap import dedent
import warnings
import weakref
import numpy as np
from pandas._libs import Timestamp, iNaT, properties
import pandas.compat as compat
from pandas.compat im... | 35.060932 | 96 | 0.53092 | [
"BSD-3-Clause"
] | kapilepatel/pandas | pandas/core/generic.py | 388,405 | Python |
# coding: utf-8
"""
Copyright 2017 Square, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable la... | 28.260417 | 77 | 0.555474 | [
"Apache-2.0"
] | reduceus/connect-python-sdk | squareconnect/models/v1_retrieve_business_request.py | 2,713 | Python |
# pylint: skip-file
import getpass
import shlex
from subprocess import PIPE # nosec
from django.core.management.base import BaseCommand
from django.utils.autoreload import run_with_reloader
import psutil
def restart_celery():
for proc in psutil.process_iter():
if proc.username() != getpass.getuser(): ... | 31.090909 | 84 | 0.682261 | [
"MIT"
] | www-norma-dev/idea-box-backend | backend/common/management/commands/celery.py | 1,026 | Python |
if True:
if True:
a = ''''Hello'<caret> - said man.\n
Let's go.
And they went out.''' | 23 | 39 | 0.443478 | [
"Apache-2.0"
] | 06needhamt/intellij-community | python/testData/intentions/convertTripleQuotedString.py | 115 | Python |
#!/usr/local/bin/python3
import json
from sys import argv
version = str(argv[1])
with open("ReactorKit", 'r+') as file:
data = json.load(file)
file.seek(0)
data[version] = "https://github.com/kawoou/ReactorKit-Carthage/releases/download/" + version + "/ReactorKit.framework.zip"
json.dump(data, file... | 31.380952 | 133 | 0.682853 | [
"MIT"
] | cruisediary/ReactorKit-Carthage | scripts/update.py | 659 | Python |
from django.shortcuts import render, redirect
from django.contrib.auth import login, authenticate
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.views.generic import View, TemplateView, FormView
def Index(request):
if request.method == 'POST':
if 'indexLogin' in requ... | 44.75 | 135 | 0.622905 | [
"MIT"
] | Ange1ique/GoalPlanner | GoalPlanner/views.py | 2,506 | Python |
from django.apps import AppConfig
class IgovMainConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'igov_main'
| 21.285714 | 56 | 0.765101 | [
"MIT"
] | morrisedu/igov_africa | igov_main/apps.py | 149 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import atexit
import json
import logging
from pathlib import Path
import platform
import shutil
import tempfile
from ty... | 32.411765 | 99 | 0.633176 | [
"MPL-2.0"
] | tdsmith/glean | glean-core/python/glean/glean.py | 13,775 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from setuptools import setup
try:
from pkg_resources import VersionConflict, require
require("setuptools>=38.3")
except VersionConflict:
print("Error: version of setuptools is too old (<38.3)!")
sys.exit(1)
def get_extra_requires(add_all=True... | 23.8 | 75 | 0.606443 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | DHARPA-Project/kiara_modules.language_processing | setup.py | 1,428 | Python |
import logging; logging.basicConfig(level=logging.INFO)
import asyncio, os, json, time
from datetime import datetime
from aiohttp import web
import aiomysql
async def index(request):
return web.Response(text='Awsome')
app = web.Application()
app.add_routes([web.get('/', index)])
logging.info('server started a... | 22 | 59 | 0.729798 | [
"Apache-2.0"
] | XuanYang-cn/Myblog | awesome-python3-webapp/www/app.py | 396 | Python |
#!/usr/bin/env python3
"""
Description:
Usage:
$> roslaunch turtle_nodes.launch
$> ./executive_step_04.py
Output:
[INFO] : State machine starting in initial state 'RESET' with userdata:
[]
[INFO] : State machine transitioning 'RESET':'succeeded'-->'SPAWN'
[INFO] : State machine tr... | 33.969072 | 89 | 0.646434 | [
"MIT"
] | OxRAMSociety/RobotArm | Smach/executive_smach_tutorials/scripts/usecase_01/executive_step_04.py | 3,295 | Python |
from .. import abc
from .. import util
importlib = util.import_importlib('importlib')
importlib_abc = util.import_importlib('importlib.abc')
machinery = util.import_importlib('importlib.machinery')
importlib_util = util.import_importlib('importlib.util')
import errno
import marshal
import os
import py_compile
import ... | 40.679503 | 93 | 0.595658 | [
"MIT"
] | Ma233/RustPython | Lib/test/test_importlib/source/test_file_loader.py | 32,747 | Python |
import logging
from django.shortcuts import get_object_or_404
from django.template import RequestContext
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic import RedirectView
from mayan.apps.acls.models import AccessControlList
from mayan.apps.docum... | 34.027273 | 78 | 0.687016 | [
"Apache-2.0"
] | Bank5323/Mayan-EDMS | mayan/apps/web_links/views.py | 7,486 | Python |
"""
pycmark.inlineparser.link_processors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Link processor classes for InlineParser.
:copyright: Copyright 2017-2019 by Takeshi KOMIYA
:license: Apache License 2.0, see LICENSE for details.
"""
import re
from typing import Tuple
from docutils import nodes
from d... | 34.758772 | 148 | 0.575521 | [
"BSD-2-Clause"
] | pycmark/pycmark | pycmark/inlineparser/link_processors.py | 7,925 | Python |
import re
import collections
from slugify import slugify
from .utils import limpa_conteudo, cria_hash_do_movimento
PADRAO_MOV = re.compile(r'numMov=(\d+)')
def parse_metadados(linhas_de_dados, numero_processo, inicio_metadados,
fim_metadados):
metadados = {
'status': [''],
'c... | 29.472081 | 74 | 0.550982 | [
"MIT"
] | MinisterioPublicoRJ/robotj | extrator/crawler/parser.py | 5,808 | 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... | 42.628571 | 318 | 0.699173 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/python/pulumi_azure_native/network/v20200701/get_virtual_network_tap.py | 8,952 | Python |
# Copyright 2019 Alastair Pharo
#
# 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 writin... | 43.603774 | 107 | 0.648637 | [
"Apache-2.0"
] | socsol/infsocsol | tests/test_fisheries_det_basic.py | 2,311 | Python |
addrs = {
"140": "[2401:db00:21:604c:face:0:5:0]",
"216": "[2401:db00:21:604c:face:0:7:0]",
"199": "[2401:db00:21:604f:face:0:5:0]",
"194": "[2401:db00:21:605b:face:0:7:0]",
"213": "[2401:db00:21:6046:face:0:7:0]",
"145": "[2401:db00:21:6043:face:0:1:0]",
"212": "[2401:db00:21:6046:face:0:5:... | 36.611111 | 65 | 0.559939 | [
"BSD-3-Clause"
] | zchen0211/ELF_inf | experimental/server_addrs.py | 659 | Python |
#!/usr/bin/env python2.7
# coding=utf-8
from __future__ import print_function
import sys, os
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
sys.path.append("../../amalgamation/python/")
sys.path.append("../../python/")
from mxnet_predict import Predictor
import mxnet as mx
import numpy as ... | 33.654762 | 107 | 0.58861 | [
"Apache-2.0"
] | YanLiang1102/dmlc-mxnet | example/warpctc/ocr_predict.py | 2,827 | Python |
import datetime
import more_itertools
from annoworkapi.actual_working_time import (
_create_actual_working_hours_dict,
create_actual_working_times_daily,
get_term_start_end_from_date_for_actual_working_time,
)
ACTUAL_WORKING_TIME_LIST = [
{
"job_id": "JOB_A",
"workspace_member_id": "a... | 33.901099 | 115 | 0.618801 | [
"MIT"
] | kurusugawa-computer/annowork-api-python-client | tests/test_local_actual_working_time.py | 3,085 | Python |
import os
# globals
PIC_EXT_NAME = '.png'
DEFAULT_TARGET_NAME = 'DEFAULT_TARGET_NAME'
ALLOWED_EXTRA_ARGS = set(
'mask_pic_path',
)
# arg parse
PORT_ENV_NAME = 'FINDIT_SERVER_PORT'
PIC_ROOT_ENV_NAME = 'FINDIT_SERVER_PIC_ROOT_PATH'
SERVER_PORT: int = int(os.environ.get(PORT_ENV_NAME, default=9410))
PIC_DIR_PATH: s... | 23.1875 | 67 | 0.778976 | [
"MIT"
] | yanzongzhen/hyper-find | findit/server/config.py | 371 | Python |
from setuptools import setup
from setuptools import find_packages
setup(name='Keras-bot-enforce-codeowners',
packages=find_packages())
| 21.285714 | 43 | 0.758389 | [
"MIT"
] | JoshuaRM/keras-bot | enforce_codeowners/setup.py | 149 | Python |
#!/usr/bin/python3
import glob
from PIL import Image
# get all the jpg files from the current folder
for infile in glob.glob("*.jpg"):
im = Image.open(infile)
# convert to thumbnail image
im.thumbnail((500, 500), Image.ANTIALIAS)
# don't save if thumbnail already exists
if infile[0:2] != "T_":
# prefix t... | 27.428571 | 47 | 0.6875 | [
"BSD-3-Clause"
] | mdr78/mdr78.github.io | scripts/mk_thumbs.py | 384 | Python |
# MIT License
#
# Copyright (c) 2019 Meyers Tom
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... | 38.984615 | 106 | 0.679163 | [
"MIT"
] | F0xedb/IS-HTTP-HEADER | runner/input.py | 2,534 | Python |
from git import Repo
import logging
from wily.archivers import BaseArchiver, Revision
logger = logging.getLogger(__name__)
class DirtyGitRepositoryError(Exception):
def __init__(self, untracked_files):
self.untracked_files = untracked_files
self.message = "Dirty repository, make sure you commit/... | 30.673469 | 81 | 0.646707 | [
"Apache-2.0"
] | wcooley/wily | wily/archivers/git.py | 1,503 | Python |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import ast
import datetime
from odoo import api, fields, models, _
from odoo.tools.safe_eval import safe_eval
class Team(models.Model):
_name = 'crm.team'
_inherit = ['mail.alias.mixin', 'crm.team']
_descr... | 47.407609 | 190 | 0.623983 | [
"Apache-2.0"
] | SHIVJITH/Odoo_Machine_Test | addons/crm/models/crm_team.py | 8,723 | Python |
import random
# ToDo: With shuffle_ganon option, prevent gtower from linking to an exit only location through a 2 entrance cave.
def link_entrances(world, player):
connect_two_way(world, 'Links House', 'Links House Exit', player) # unshuffled. For now
connect_exit(world, 'Chris Houlihan Room Exit', 'Links Ho... | 59.117923 | 457 | 0.56081 | [
"MIT"
] | Nathan-Carlson/ALttPDoorRandomizer | EntranceShuffle.py | 226,599 | Python |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | 41.104396 | 79 | 0.634273 | [
"Apache-2.0"
] | daniel-hou0/horizon | django-openstack/django_openstack/dash/views/floating_ips.py | 7,481 | Python |
import inspect
import unittest
from config.database import DATABASES
from src.masoniteorm.connections import ConnectionFactory
from src.masoniteorm.models import Model
from src.masoniteorm.query import QueryBuilder
from src.masoniteorm.query.grammars import SQLiteGrammar
from src.masoniteorm.relationships import belon... | 33.264706 | 65 | 0.693192 | [
"MIT"
] | MasoniteFramework/orm | tests/sqlite/builder/test_sqlite_builder_pagination.py | 2,262 | Python |
# ============================================================================
# ============================================================================
# Copyright (c) 2021 Nghia T. Vo. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... | 44.056818 | 80 | 0.570286 | [
"Apache-2.0"
] | gbzan/algotom | tests/test_prep/test_filtering.py | 3,877 | Python |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from fairseq import utils
class TestUtils(unittest.TestCase):
def test_convert_padding_direction(self):
... | 28.652174 | 78 | 0.493475 | [
"MIT"
] | 1-punchMan/fairseq | tests/test_utils.py | 3,295 | Python |
#!/usr/bin/env python3
# encoding: utf-8
import os
import cv2
cv2.setNumThreads(0)
import numpy as np
from utils.visualize import print_iou, show_img, show_prediction
from engine.evaluator import Evaluator
from engine.logger import get_logger
from seg_opr.metric import hist_info, compute_score
logger = get_logger()
... | 39.084507 | 123 | 0.619459 | [
"MIT"
] | SuzukiDaichi-git/ai_edge_contest | train/eval.py | 2,775 | Python |
# for value in range(1,9):
# print(' * ' * (9 - value))
# print("---------------------------")
# for i in range(5):
# for j in range(i+1):
# print(" O ", end="")
# print()
# print("---------------------------")
# for i in range(5):
# for s in range(i):
# print(" ", end="")
... | 22.382353 | 39 | 0.321945 | [
"MIT"
] | Kunal3Kumar/Assignment | pattern.py | 761 | Python |
import dataclasses
import warnings
import numpy as np
import torch
def to_device(data, device=None, dtype=None, non_blocking=False, copy=False):
"""Change the device of object recursively"""
if isinstance(data, dict):
return {
k: to_device(v, device, dtype, non_blocking, copy) for k, v in... | 37.236111 | 88 | 0.645655 | [
"Apache-2.0"
] | 18445864529/espnet | espnet2/torch_utils/device_funcs.py | 2,681 | Python |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 35.424769 | 101 | 0.571275 | [
"Apache-2.0"
] | LaudateCorpus1/python-datalabeling | google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py | 30,607 | Python |
from itertools import chain, starmap
from typing import Any, Tuple
def flatten_json(dictionary: dict) -> dict:
"""Flatten a nested json file"""
while True:
dictionary = dict(chain.from_iterable(starmap(_unpack, dictionary.items())))
if _atomic_values(dictionary):
break
return ... | 28.653061 | 84 | 0.690171 | [
"MIT"
] | BentoBox-Project/activejson | activejson/flatten_json_tools.py | 1,404 | Python |
'''subclassing kde
Author: josef pktd
'''
import numpy as np
from numpy.testing import assert_almost_equal, assert_
import scipy
from scipy import stats
import matplotlib.pylab as plt
class gaussian_kde_set_covariance(stats.gaussian_kde):
'''
from Anne Archibald in mailinglist:
http://www.nabble.com/Wid... | 34.357576 | 101 | 0.646499 | [
"BSD-3-Clause"
] | ADI10HERO/statsmodels | statsmodels/sandbox/nonparametric/kdecovclass.py | 5,669 | Python |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | 30.011628 | 103 | 0.844828 | [
"Apache-2.0"
] | PlasticMem/tencentcloud-sdk-python | tencentcloud/facefusion/v20181201/errorcodes.py | 6,162 | Python |
"""included ordering for sections
Revision ID: 91052a50e2b0
Revises: 5716caecc491
Create Date: 2020-06-26 14:49:21.905034
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '91052a50e2b0'
down_revision = '5716caecc491'
branch_labels = None
depends_on = None
def ... | 24.551724 | 109 | 0.706461 | [
"MIT"
] | Juan7655/wfh-movies | app/alembic/versions/2020_06_26_14_49_21.py | 712 | Python |
class RSVPRouter(object):
"""
A router to control all database operations on models in the
rsvp application.
"""
apps = ["rsvp"]
using = "rsvp_db"
def db_for_read(self, model, **hints):
if model._meta.app_label in self.apps:
return self.using
return None
... | 29.613636 | 82 | 0.585572 | [
"MIT"
] | ehayne/KyleAndEmily | kyleandemily/rsvp/db_router.py | 1,303 | Python |
from crypt import methods
from unicodedata import name
from flask import Flask, render_template, request, session, logging, url_for, redirect, flash
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from passlib.hash import sha256_crypt
from flask_login import login_user
engi... | 27.380165 | 94 | 0.620284 | [
"MIT"
] | Kingsly62/Pitches-Application | main.py | 3,313 | Python |
"""Several tools used accross by other modules"""
import logging
from logging.handlers import BufferingHandler
from asyncio import sleep, get_event_loop
from datetime import datetime, timedelta
from distutils.util import strtobool
from os.path import abspath, dirname
from typing import Union, Optional, List
from uuid ... | 27.988024 | 79 | 0.617672 | [
"MIT"
] | JWebgames/WebAPI | webapi/tools.py | 4,674 | Python |
"""The base class and interface for all formatting plugins."""
import argparse
import os
import sys
from typing import IO
from typing import List
from typing import Optional
from typing import Tuple
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from flake8.statistics import Statistics
from flake8.style_gu... | 35.764151 | 78 | 0.616196 | [
"MIT"
] | AWSCookbook/Databases | .venv/lib/python3.9/site-packages/flake8/formatting/base.py | 7,582 | Python |
import os, logging
from flask import Flask, request
from werkzeug.serving import run_simple
from galaxylearning.utils.utils import return_data_decorator, LoggerFactory
app = Flask(__name__)
BASE_MODEL_PATH = os.path.join(os.path.abspath("."), "res", "models")
logger = LoggerFactory.getLogger(__name__, logging.INFO)
... | 37.833333 | 108 | 0.731278 | [
"Apache-2.0"
] | ZJU-DistributedAI/GalaxyLearning | galaxylearning/core/communicate_client.py | 1,589 | Python |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Testing Tracker on Fashion MNIST',
author='Danish Technological Institute (DTI Research)',
license='BSD-3',
)
| 23.090909 | 59 | 0.692913 | [
"BSD-3-Clause"
] | nily-dti/tracker_fashion_mnist_example | setup.py | 254 | Python |
import logging
def webapp_add_wsgi_middleware(app):
try:
from google.appengine.ext.appstats import recording
except ImportError, err:
logging.info('Failed to import recording: %s', err)
else:
app = recording.appstats_wsgi_middleware(app)
return app
appstats_KEY_DISTANCE = 10
appstats_MAX_REPR = 10... | 21.789474 | 55 | 0.73913 | [
"Apache-2.0"
] | alltyme/appengine-ndb-experiment | appengine_config.py | 414 | Python |
# Generated by Django 2.2.13 on 2020-11-05 11:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("workflow_handler", "0030_auto_20201103_1718"),
]
operations = [
migrations.AddField(
model_name="task",
name="corre... | 20.631579 | 56 | 0.604592 | [
"Apache-2.0"
] | Human-Lambdas/human-lambdas | src/human_lambdas/workflow_handler/migrations/0031_task_correct.py | 392 | Python |
"""Tools to assist importing optional external modules."""
import sys
import re
# Override these in the module to change the default warning behavior.
# For example, you might set both to False before running the tests so that
# warnings are not printed to the console, or set both to True for debugging.
WARN_NOT_INS... | 40.854167 | 89 | 0.668027 | [
"MIT"
] | LuisMi1245/QPath-and-Snakes | .environment/lib/python3.8/site-packages/sympy/external/importtools.py | 7,844 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.