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 math
a1=float(input("Enter a number: "))
print("{} to int is {}".format(a1,math.floor(a1)))
a2=1.5
print(math.trunc(a2))
a3=3.14
print(int(a3)) | 16.888889 | 50 | 0.657895 | [
"MIT"
] | jhonatanmaia/python | study/curso-em-video/exercises/016.py | 152 | Python |
"""
Copyright (c) 2014-2015 F-Secure
See LICENSE for details
"""
import re
import inspect
import datetime
from copy import copy
from collections import defaultdict
import isodate
import pytz
from .errors import ValidationError, DeclarationError
class BaseField(object):
"""
Superclass for all fields
des... | 33.310178 | 117 | 0.61065 | [
"Apache-2.0"
] | F-Secure/resource-api | src/resource_api/schema.py | 20,619 | Python |
"""
The tool to check the availability or syntax of domains, IPv4, IPv6 or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ ... | 34.65748 | 88 | 0.546291 | [
"MIT"
] | NeolithEra/PyFunceble | PyFunceble/output/clean.py | 9,585 | Python |
class BaseFileGetter:
async def get_file(self, file_id: str):
raise NotImplementedError()
async def get_userpic(self, user_id: int):
raise NotImplementedError()
async def get_thumb(self, message):
"""
Тупой алгоритм,
который рекурсивно с конца ищет поле "thumb"
... | 29.622642 | 54 | 0.52293 | [
"MIT"
] | Forevka/tgquote | tgquote/filegetters/base.py | 1,716 | Python |
"""
ANIMATE RIGID OBJECTS IN BLENDER.
Requirements:
------------------------------------------------------------------------------
IMPORTANT! This has only been tested with Blender 2.79 API.
Warnings:
------------------------------------------------------------------------------
Do not expect all blends to be perfect... | 37.385621 | 91 | 0.568182 | [
"MIT"
] | creativefloworg/creativeflow | creativeflow/blender/animate_main.py | 5,720 | Python |
"""search init"""
from pathfinder.search.algorithm import Algorithm
| 22.666667 | 49 | 0.794118 | [
"MIT"
] | rpfarish/pathfinder_visualizer | pathfinder/search/__init__.py | 68 | Python |
import cv2
import numpy as np
green = np.uint8([[[255,0,0]]])
hsv_green = cv2.cvtColor(green,cv2.COLOR_BGR2HSV)
print(hsv_green)
| 19.428571 | 50 | 0.705882 | [
"MIT"
] | KiLJ4EdeN/CV_PYTHON | CV_PYTHON/IMG_2.py | 136 | 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... | 43.335821 | 92 | 0.769588 | [
"Apache-2.0"
] | LottieWang/mindspore | tests/st/fl/mobile/test_mobile_lenet.py | 5,807 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-12 00:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Accoun... | 37.333333 | 114 | 0.584821 | [
"Apache-2.0"
] | shtanaka/dang | authentication/migrations/0001_initial.py | 1,344 | Python |
from django.apps import AppConfig
class CodecoverageConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'codecoverage'
| 22.285714 | 56 | 0.775641 | [
"Apache-2.0"
] | IsmatAl/thesisProject | backend/dynamicanalysis/codecoverage/apps.py | 156 | Python |
#! /usr/bin/env python3.6
from selenium import webdriver
import time
browser = webdriver.Chrome(executable_path='/home/coslate/anaconda3/bin/chromedriver')
#url = 'https://stats.nba.com/leaders'
url = 'http://stats.nba.com/teams/traditional/#!?sort=W_PCT&dir=-1'
browser.get(url)
time.sleep(5)
#browser.find_element_by... | 44.653846 | 130 | 0.750215 | [
"MIT"
] | Coslate/NBA_Win_Predictor | crawler/test_code/test_selenium.py | 1,177 | Python |
# Large amount of credit goes to:
# https://github.com/keras-team/keras-contrib/blob/master/examples/improved_wgan.py
# which I've used as a reference for this implementation
from __future__ import print_function, division
from keras.datasets import mnist
from keras.layers.merge import _Merge
from keras.layers impor... | 36.414634 | 99 | 0.590534 | [
"MIT"
] | 311nguyenbaohuy/Keras-GAN | wgan_gp/wgan_gp.py | 8,958 | Python |
"""
sphinx.writers.texinfo
~~~~~~~~~~~~~~~~~~~~~~
Custom docutils writer for Texinfo.
:copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import textwrap
import warnings
from os import path
from typing import (TYPE_CHECKING, Any, ... | 33.919263 | 107 | 0.571643 | [
"BSD-2-Clause"
] | Bibo-Joshi/sphinx | sphinx/writers/texinfo.py | 53,356 | Python |
class Pessoa:
def __init__(self, nome, idade):
self._nome = nome
self._idade = idade
@property
def nome(self):
return self._nome
@property
def idade(self):
return self._idade
class Cliente(Pessoa):
def __init__(self, nome, idade):
super().__init__(no... | 17.84 | 40 | 0.59417 | [
"MIT"
] | renatodev95/Python | aprendizado/udemy/03_desafio_POO/cliente.py | 446 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 22 17:28:54 2018
@author: galengao
This is the original analysis code as it exists in the environment where it was writen and initially run.
Portions and modifications of this script constitute all other .py scripts in this directory.
"""
import nu... | 47.773279 | 142 | 0.667627 | [
"MIT"
] | gaog94/GDAN_QC_CopyNumber | scripts/AnalysisCode.py | 11,800 | Python |
import unittest
from datatypes.exceptions import DataDoesNotMatchSchemaException
from datatypes import postcode_validator
class TestPostcodeValidation(unittest.TestCase):
def test_can_validate_postcode(self):
try:
postcode_validator.validate("WC2B6SE")
postcode_validator.validate... | 43.366667 | 99 | 0.752498 | [
"MIT"
] | LandRegistry/datatypes-alpha | tests/test_postcode_validation.py | 1,301 | Python |
from colored import fg, stylize, attr
import requests as rq
from yaspin import yaspin
version = "0.4beta"
greeting = stylize("""
╭────────────────────────────────────────────────────────────────╮
│ Добро пожаловать в │
│ _____ _ _ ____ _... | 32.503268 | 103 | 0.48703 | [
"MIT"
] | yakuri354/EljurCLI | eljur.py | 5,600 | Python |
from datetime import date
from dateutil.relativedelta import relativedelta
from django.contrib.auth.models import Group
from django.contrib.gis.geos import GEOSGeometry
from django.core.mail import send_mail
from ..api.get_table import *
from ..utils.get_data import has_access, is_int, is_float
from ..water_network.m... | 39.714681 | 117 | 0.645812 | [
"MIT"
] | exavince/HaitiWater | code/haitiwater/apps/api/add_table.py | 14,381 | Python |
from datasets.data import documents,data
for doc in documents.find():
print(doc['admitted']) | 24.25 | 40 | 0.742268 | [
"MIT"
] | pmwaniki/ppg-analysis | datasets/descriptives.py | 97 | Python |
# Author: Luke Bloy <bloyl@chop.edu>
#
# License: BSD (3-clause)
import numpy as np
import os.path as op
import datetime
import calendar
from .utils import _load_mne_locs
from ...utils import logger, warn
from ..utils import _read_segments_file
from ..base import BaseRaw
from ..meas_info import _empty_info
from ..con... | 38.933086 | 79 | 0.575862 | [
"BSD-3-Clause"
] | mvdoc/mne-python | mne/io/artemis123/artemis123.py | 10,473 | Python |
"""The DAS response.
The DAS response describes the attributes associated with a dataset and its
variables. Together with the DDS the DAS response completely describes the
metadata of a dataset, allowing it to be introspected and data to be
downloaded.
"""
try:
from functools import singledispatch
except ImportE... | 29.216049 | 78 | 0.637439 | [
"MIT"
] | JohnMLarkin/pydap | src/pydap/responses/das.py | 4,733 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-11-11 04:06
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | 37.136364 | 148 | 0.639535 | [
"MIT"
] | niwo/seven23_server | seven23/models/terms/migrations/0001_initial.py | 1,634 | Python |
# pypi
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config
# local
from ..lib.handler import Handler
from ...lib import db as lib_db
from ...lib import errors
from ...model import utils as model_utils
# ==============================================================================
cl... | 36.484277 | 93 | 0.508102 | [
"MIT"
] | jvanasco/peter_sslers | src/peter_sslers/web/views_admin/operation.py | 11,602 | Python |
#######################################################################
# Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
################################... | 38.230769 | 114 | 0.586184 | [
"MIT"
] | neale/HyperDeepRL | deep_rl/network/hyper_heads.py | 4,473 | Python |
from django.utils import timezone
from .forms import SchedDayForm
class AdminCommonMixin(object):
"""
common methods for all admin class
set default values for owner, date, etc
"""
def save_model(self, request, obj, form, change):
try:
obj.created_by = request.user
exce... | 28.367089 | 67 | 0.594378 | [
"MIT"
] | dvek/scyp | schedules/mixins.py | 2,241 | Python |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP 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 applicabl... | 39.392405 | 117 | 0.587725 | [
"Apache-2.0"
] | vinayya/nlp | datasets/daily_dialog/daily_dialog.py | 6,224 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
#
# Licensed under the GNU General Public License, version 3 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://jxs... | 36.222222 | 126 | 0.634969 | [
"Apache-2.0"
] | SF-Technology/SFO | sfo_server/decorate.py | 3,725 | Python |
import itertools
m,n = input().split()
n = int(n)
l = [ ''.join(list(i)) for i in list(itertools.permutations(list(m), n))]
l.sort()
for i in l:
print(i) | 22.428571 | 73 | 0.617834 | [
"MIT"
] | abhinavgunwant/hackerrank-solutions | Domains/Python/06 - Itertools/itertools.permutations()/solution.py | 157 | Python |
# Copyright 2013-2021 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 os
class PyPybind11(CMakePackage):
"""pybind11 -- Seamless operability between C++11 and ... | 43.426966 | 111 | 0.682536 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | ikitayama/spack | var/spack/repos/builtin/packages/py-pybind11/package.py | 3,865 | Python |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""URL endpoint to allow Buildbot slaves to post data to the dashboard."""
import copy
import json
import logging
import math
import re
from google.appengi... | 34.455206 | 80 | 0.693921 | [
"BSD-3-Clause"
] | bopopescu/catapult-2 | dashboard/dashboard/add_point.py | 28,460 | Python |
import spacy
# 读取zh_core_web_md流程
nlp = spacy.load("zh_core_web_md")
# 处理文本
doc = nlp("两只老虎跑得快")
for token in doc:
print(token.text)
# 获取词符"老虎"的向量
laohu_vector = doc[2].vector
print(laohu_vector)
| 13.6 | 34 | 0.720588 | [
"MIT"
] | admariner/spacy-course | exercises/zh/solution_02_09.py | 252 | Python |
'''
Second example calculation from:
Smart, S. E., & Mazziotti, D. A. (2021). Lowering tomography costs in quantum simulation
with a symmetry projected operator basis. Physical Review A, 103(1), 012420.
https://doi.org/10.1103/PhysRevA.103.012420
Here we are simuatling a noisy quantum system using a tun... | 28.170854 | 229 | 0.616482 | [
"Apache-2.0"
] | damazz/HQCA | examples/r2021_pra_tomography/02_pra_example_2.py | 5,606 | Python |
from lib.helper.helper import *
from random import randint
from bs4 import BeautifulSoup
from urllib.parse import urljoin,urlparse,parse_qs,urlencode
from lib.helper.Log import *
class core:
@classmethod
def generate(self,eff):
FUNCTION=[
"prompt(5000/200)",
"alert(6000/3000)",
"alert(document.cookie)... | 30.125 | 118 | 0.617716 | [
"MIT"
] | MohamedTarekq/PwnXSS | lib/core.py | 5,543 | Python |
# ----------------------------------------------------------------------------
# Imports:
# ----------------------------------------------------------------------------
from dpa.action import Action, ActionError
from dpa.ptask.action.sync import _PTaskSyncAction
from dpa.location import current_location_code
from dpa... | 36.4 | 78 | 0.467582 | [
"MIT"
] | Clemson-DPA/dpa-pipe | dpa/ptask/action/source.py | 1,820 | Python |
import os
import csv, json
from collections import defaultdict
from expertise.evaluators.mean_avg_precision import eval_map
from expertise.evaluators.hits_at_k import eval_hits_at_k
from expertise.dataset import Dataset
from expertise import utils
import ipdb
def setup(config):
assert os.path.exists(config.tpms_s... | 36.052083 | 105 | 0.664259 | [
"MIT"
] | iesl/openreview-expertise | expertise/models/tpms/tpms.py | 3,461 | Python |
"""
Module: 'collections' on esp32 1.11.0
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11 on 2019-05-29', machine='ESP32 module with ESP32')
# Stubber: 1.3.2
class OrderedDict:
''
def clear():
pass
def copy():
pass
def fromkeys():
pass
def ... | 12.555556 | 126 | 0.49115 | [
"MIT"
] | AssimilatedGuy/micropython-stubs | stubs/micropython-esp32-1_11/collections.py | 678 | Python |
from kivy.app import App
from kivy.uix.label import Label
class ChildApp(App):
def build(self):
return Label(text='Child')
if __name__ == '__main__':
ChildApp().run()
| 16.909091 | 34 | 0.666667 | [
"MIT"
] | hirossan4049/Schreen | tests/twokivys2.py | 186 | Python |
import os
import lcd
from Maix import GPIO
from board import board_info
from fpioa_manager import fm
# import uos
S_IFDIR = 0o040000 # directory
# noinspection PyPep8Naming
def S_IFMT(mode):
"""Return the portion of the file's mode that describes the
file type.
"""
return mode & 0o170000
# noin... | 31.478632 | 76 | 0.587293 | [
"Apache-2.0"
] | eggfly/M5StickVComputer | others/explorer_standalone.py | 3,683 | Python |
import numpy as np
def log_sum_exp(x, axis=-1):
a = x.max(axis=axis, keepdims=True)
out = a + np.log(np.sum(np.exp(x - a), axis=axis, keepdims=True))
return np.squeeze(out, axis=axis)
def kl_normal(qm, qv, pm, pv):
return 0.5 * np.sum(np.log(pv) - np.log(qv) + qv/pv +
np.square... | 31.202703 | 85 | 0.585535 | [
"MIT"
] | Hirokazu-Narui/tensorbayes | tensorbayes/nputils.py | 2,309 | Python |
from tytus.parser.team21.Analisis_Ascendente.Instrucciones.Expresiones.Expresion import Expresion
from tytus.parser.team21.Analisis_Ascendente.Instrucciones.expresion import Primitivo
from tytus.parser.team21.Analisis_Ascendente.Instrucciones.instruccion import Instruccion
from tytus.parser.team21.Analisis_Ascendente.s... | 44.622517 | 277 | 0.557955 | [
"MIT"
] | 201503484/tytus | parser/team21/Analisis_Ascendente/Instrucciones/Insert/insert.py | 13,476 | Python |
import pytest
from vnc_api import vnc_api
from cvfm import services
@pytest.fixture
def dvs_service(vcenter_api_client, vnc_api_client, database):
return services.DistributedVirtualSwitchService(
vcenter_api_client, vnc_api_client, database
)
@pytest.fixture
def port_1():
port = vnc_api.Port("... | 24.830769 | 78 | 0.715613 | [
"Apache-2.0"
] | atsgen/tf-vcenter-fabric-manager | tests/unit/services/test_dvs_service.py | 1,614 | Python |
from django.db import models
from osoba.models import ServiseID, Company
from django.utils.translation import gettext as _
class SHPK(models.Model):
name = models.CharField(max_length=512, verbose_name=_('Name'))
short_name = models.CharField(max_length=512, verbose_name=_('Short name'))
def __str__(self... | 30.308851 | 162 | 0.692929 | [
"Apache-2.0"
] | VadymRud/zampol | zampol/staff/models.py | 16,122 | Python |
import unittest
from mock import Mock, patch
from cumulusci.salesforce_api.utils import get_simple_salesforce_connection
from cumulusci.core.exceptions import ServiceNotConfigured
from cumulusci import __version__
class TestSalesforceApiUtils(unittest.TestCase):
@patch("simple_salesforce.Salesforce")
def test... | 37.322034 | 85 | 0.702997 | [
"BSD-3-Clause"
] | bethbrains/CumulusCI | cumulusci/salesforce_api/tests/test_utils.py | 2,202 | Python |
# -*- coding: utf-8 -*-
"""Define general test helper attributes and utilities."""
import os
import sys
TRAVIS=os.getenv("TRAVIS_PYTHON_VERSION") is not None
PYTHON_VERSION = "%s.%s" % (sys.version_info.major, sys.version_info.minor)
TMP_DIR="/tmp"
| 27.777778 | 75 | 0.728 | [
"MIT"
] | bobatsar/moviepy | tests/test_helper.py | 250 | Python |
import ipdb
import medis.speckle_nulling.sn_hardware as hardware
import medis.speckle_nulling.sn_preprocessing as pre
import numpy as np
import os
import astropy.io.fits as pf
import medis.speckle_nulling.sn_filehandling as flh
from configobj import ConfigObj
def build_median(imagelist, outputfile = None):
"""Tak... | 43.040984 | 358 | 0.6235 | [
"MIT"
] | RupertDodkins/MEDIS | medis/speckle_nulling/take_flats_and_darks_old.py | 5,251 | Python |
class Solution:
def canPlaceFlowers(self, flowerbed, n: int) -> bool:
# Even with an empty list, the maximum amount we can place
# is len(flowerbed) // 2 (+ 1 if odd, +0 if even)
length = len(flowerbed)
if n > (length // 2) + 1 * (length & 1):
return False
# bail ... | 36.125 | 67 | 0.398501 | [
"Unlicense"
] | DimitrisJim/leet | Python/Algorithms/605.py | 1,734 | Python |
def belong(in_list1: list, in_list2: list) -> list:
"""
Check wheter or not all the element in list in_list1 belong into in_list2
:param in_list1: the source list
:param in_list2: the target list where to find the element in in_list1
:return: return True if the statement is verified otherwise return... | 42.818182 | 77 | 0.698514 | [
"MIT"
] | angelmpalomares/ModelAndLanguagesForBioInformatics | Python/List/14.belong.py | 471 | Python |
#
# PySNMP MIB module CISCO-WAN-FR-CONN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-FR-CONN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:20:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | 224.971354 | 3,885 | 0.765676 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp-with-texts/CISCO-WAN-FR-CONN-MIB.py | 86,389 | Python |
from typing import List
from pyarc.data_structures.car import ClassAssocationRule
from pyarc.data_structures.antecedent import Antecedent as CARAntecedent
from pyarc.data_structures.consequent import Consequent as CARConsequent
from mdrsl.data_structures.rules.generalized_rule_part import GeneralizedAntecedent
from m... | 44.933333 | 98 | 0.818991 | [
"Apache-2.0"
] | joschout/Multi-Directional-Rule-Set-Learning | mdrsl/rule_generation/association_rule_mining/convert_single_target_car_to_multi_target_car.py | 1,348 | Python |
import numpy as np
from plots import plots_for_predictions as pp
import sys
sys.path.append('/Users/lls/Documents/mlhalos_code/')
from mlhalos import distinct_colours as dc
import matplotlib.pyplot as plt
from pickle import load
c = dc.get_distinct(6)
path = '/Users/lls/Documents/deep_halos_files/mass_range_13.4/rand... | 44.190476 | 114 | 0.737069 | [
"MIT"
] | lluciesmith/DeepHalos | paper_plots/plot_likelihood.py | 928 | Python |
from __future__ import absolute_import
from .implementations import ChildDiffingMixing, ImplementationBase
from .differ import make_differ
import xml.dom.minidom as dom
import re
class DiffXMLDocument(ChildDiffingMixing, ImplementationBase):
diffs_types = dom.Document
def path_and_child(self, doc):
yield "?xml@... | 25.695652 | 67 | 0.705584 | [
"BSD-2-Clause"
] | clarabstract/treecompare | treecompare/xml.py | 1,182 | Python |
"""
Adds troposphere methods for adding scaling to a cluster
"""
from troposphere.awslambda import Function, Code, Environment, Permission
from troposphere import Ref, Sub, GetAtt
from troposphere.iam import Role, Policy
from troposphere.events import Target, Rule
from troposphere.ssm import Parameter
from ecs_cluster_... | 36.961538 | 134 | 0.475338 | [
"MIT"
] | apollusehs-devops/ecs-cluster-deployer | ecs_cluster_deployer/compute/lambda_scaler.py | 4,805 | Python |
#!/usr/bin/python
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.helpers import ModuleRes, CartridgeException, cartridge_errcodes
from ansible.module_utils.helpers import get_control_console
from ansible.module_utils.helpers import dynamic_box_cfg_params
import os
argument_spec = {
... | 33.508475 | 94 | 0.662452 | [
"BSD-2-Clause"
] | armohamm/ansible-cartridge | library/cartridge_needs_restart.py | 5,931 | Python |
import sys, os
sys.path.append('../../') #get rid of this at some point with central test script or when package is built
os.chdir('../../')
import MSI.simulations.instruments.shock_tube as st
import MSI.cti_core.cti_processor as pr
import MSI.optimization.matrix_loader as ml
import MSI.optimization.opt_runner as opt
... | 77.023973 | 279 | 0.537504 | [
"MIT"
] | TheBurkeLab/MSI | tests/shock_tube_optimization_shell_six_paramter_fit_test_modified.py | 22,491 | Python |
# Copyright 2020 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... | 31.920455 | 81 | 0.700961 | [
"Apache-2.0"
] | 233-puchi/mindspore | mindspore/ops/_op_impl/aicpu/stack_push_pop.py | 2,809 | Python |
from tree import TreeNode
def min_depth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root is None:
return 0
if root.left is not None or root.right is not None:
return max(self.minDepth(root.left), self.minDepth(root.right))+1
return min(self.minDepth(root.left),... | 23.963636 | 73 | 0.593323 | [
"MIT"
] | AdrialYeoh/algorithms | algorithms/tree/min_height.py | 1,318 | Python |
import argparse
import ceserver
import tensorflow as tf
tf.keras.backend.clear_session()
from .model import AlibiDetectModel
DEFAULT_MODEL_NAME = "model"
parser = argparse.ArgumentParser(parents=[ceserver.server.parser])
parser.add_argument('--model_name', default=DEFAULT_MODEL_NAME,
help='The ... | 28.681818 | 68 | 0.729002 | [
"Apache-2.0"
] | NunoEdgarGFlowHub/alibi-detect | integrations/adserver/adserver/__main__.py | 631 | Python |
__author__ = 'Bohdan Mushkevych'
from odm.fields import BooleanField, StringField, DictField, ListField, NestedDocumentField
from odm.document import BaseDocument
from synergy.db.model.job import Job
from synergy.db.model.managed_process_entry import ManagedProcessEntry
from synergy.db.model.freerun_process_entry imp... | 28.657895 | 91 | 0.795225 | [
"BSD-3-Clause"
] | mushkevych/scheduler | synergy/mx/rest_model.py | 1,089 | Python |
from winning.lattice_copula import gaussian_copula_margin_0
from winning.lattice import skew_normal_density
from winning.lattice_plot import densitiesPlot
from pprint import pprint
def test_ensure_scipy():
from winning.scipyinclusion import using_scipy
from scipy.integrate import quad_vec
assert using_sc... | 29.103448 | 117 | 0.727488 | [
"MIT"
] | microprediction/winning | tests/test_lattice_five_margin.py | 844 | 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 os
from django.core.management.base import BaseCommand
from django.conf import settings
from lib.l10n_utils.get... | 30.964286 | 69 | 0.665513 | [
"MPL-2.0"
] | SekhmetDesign/bedrock | lib/l10n_utils/management/commands/l10n_merge.py | 867 | Python |
#-*- coding: utf-8 -*-
from DBP.models import Base, session
from DBP.models.user import User
from sqlalchemy.orm import class_mapper
from sqlalchemy.inspection import inspect
from sqlalchemy.sql import func
from sqlalchemy.dialects.mysql import INTEGER,VARCHAR, DATETIME
from datetime import datetime
import csv
import... | 24.083333 | 176 | 0.68136 | [
"MIT"
] | Pusnow/DB-Project | DBP/models/instance.py | 6,647 | Python |
import os
import subprocess
import uuid
import nest_asyncio
import uvicorn
from pyngrok import ngrok
try:
from google.colab import drive
colab_env = True
except ImportError:
colab_env = False
EXTENSIONS = ["ms-python.python", "ms-toolsai.jupyter", "mechatroner.rainbow-csv", "vscode-icons-team.vscode-i... | 31.205128 | 168 | 0.579567 | [
"MIT"
] | pandya6988/colabcode | colabcode/code.py | 3,651 | Python |
# Copyright (C) 2017 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | 37.889831 | 72 | 0.497652 | [
"Apache-2.0"
] | HoonMinJeongUm/HoonMin-devstack | roles/write-devstack-local-conf/library/test.py | 8,942 | 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, ... | 43.661202 | 136 | 0.637672 | [
"Apache-2.0"
] | JohnPaton/pipelines | sdk/python/kfp/compiler/_k8s_helper.py | 7,990 | Python |
"""Webhook tests for mobile_app."""
import logging
import pytest
from homeassistant.components.camera import SUPPORT_STREAM as CAMERA_SUPPORT_STREAM
from homeassistant.components.mobile_app.const import CONF_SECRET
from homeassistant.components.zone import DOMAIN as ZONE_DOMAIN
from homeassistant.const import CONF_WE... | 31.799511 | 105 | 0.685068 | [
"Apache-2.0"
] | Bonnee/core | tests/components/mobile_app/test_webhook.py | 13,006 | Python |
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# Copyright 2016 FUJITSU LIMITED
# 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
#... | 38.830882 | 87 | 0.635296 | [
"Apache-2.0"
] | martinchacon/monasca-notification | monasca_notification/common/utils.py | 5,281 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Christian Heider Nielsen"
__doc__ = r"""
"""
import h5py
import torch
import torch.utils
import torch.utils.data
from .h5_mnist_data import download_binary_mnist
def load_binary_mnist(cfg, **kwcfg):
fname = cfg.data_dir / "binary_mnist.h5... | 29.820513 | 72 | 0.684437 | [
"Apache-2.0"
] | cnheider/vision | samples/regression/vae/flow/data_loader.py | 1,163 | Python |
import json
import os
# set working directory
def gen_json(t):
print(os.getcwd())
# read log file
with open('Screenshots/Screenshoot_meta.txt', 'r') as f:
log = f.read()
data = {"camera_angle_x": 0.6911112070083618}
frames = []
line_cnt = 0
for line in log.split('\n... | 27.655172 | 118 | 0.495012 | [
"MIT"
] | songrise/nerf | my_src/meta_json.py | 802 | Python |
# This program and the accompanying materials are made available under the
# terms of the Mozilla Public License v2.0 which accompanies this distribution,
# and is available at https://www.mozilla.org/en-US/MPL/2.0/
from pyincore.utils.cgeoutputprocess import CGEOutputProcess
import os
PYINCOREPATH = "path-to-pyincor... | 44.205882 | 91 | 0.612774 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | IN-CORE/pyincore | tests/pyincore/utils/test_csvoutputjson.py | 1,503 | Python |
import numpy as np
import matplotlib.pyplot as plt
import time
from IPython import display
# Implemented methods
methods = ['DynProg', 'ValIter'];
# Some colours
LIGHT_RED = '#FFC4CC';
LIGHT_GREEN = '#95FD99';
BLACK = '#000000';
WHITE = '#FFFFFF';
LIGHT_PURPLE = '#E8D0FF';
LIGHT_ORANGE = '#FAE0C3';
... | 37.297968 | 170 | 0.57308 | [
"MIT"
] | takeitbillykyle/EL2805-Reinforcement-Learning- | Assignment 2/robbing_banks.py | 16,523 | Python |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=invalid-name, bad-continuation
"""Provider for local backends."""
import logging
from qiskit._qiskiterror... | 35.829268 | 79 | 0.640345 | [
"Apache-2.0"
] | Hosseinyeganeh/qiskit-core | qiskit/backends/local/localprovider.py | 4,407 | Python |
# -*- coding: utf-8 -*-
"""
product.py
Implementing Add listing wizard for downstream modules:
* In the __setup__ method of `product.listing.add.start` in downstream
module, add the type as a valid channel type. Since this is non trivial
a convenience method `add_source` is provided which will add the source
... | 31.224543 | 93 | 0.619199 | [
"BSD-3-Clause"
] | aniforprez/trytond-sale-channel | product.py | 11,959 | Python |
# Copyright 2012, VMware, 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 agre... | 40.252427 | 79 | 0.607212 | [
"Apache-2.0"
] | bradleyjones/neutron | neutron/tests/unit/agent/linux/test_utils.py | 8,292 | Python |
import logging
from urllib.parse import urljoin
import scrapy
from scrapy import Request
from scrapy_selenium import SeleniumRequest
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from sainsburys.items import SainsburysItem
logger = logging.getLogger('s... | 30.576923 | 153 | 0.667086 | [
"MIT"
] | carrasquel/scrapy-practice | sainsburys/sainsburys/spiders/basic.py | 2,385 | Python |
import pickle
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
import torch.nn as nn
def load_pickle(pickle_file):
try:
with open(pickle_file, 'rb') as f:
pickle_data = pickle.load(f)
except UnicodeDecodeError as e:
with open(pickle_file, 'rb') as f:... | 42.455285 | 127 | 0.677135 | [
"MIT"
] | HughMun/MultiBench | deprecated/dataloaders/affect/humor_dataset.py | 5,222 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "travel.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | 34.956522 | 77 | 0.641791 | [
"MIT"
] | NaimJamalludin/Travelevart | travel/manage.py | 804 | Python |
class Solution:
def maxChunksToSorted(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
stacks = []
for num in arr:
if not stacks:
stacks.append([num])
elif num >= stacks[-1][0]:
stacks.append([num])
... | 28.71875 | 73 | 0.40914 | [
"MIT"
] | feigaochn/leetcode | p768_max_chunks_to_make_sorted_ii.py | 919 | Python |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | 57.295455 | 504 | 0.74838 | [
"Apache-2.0"
] | extremenetworks/pybind | pybind/slxos/v17r_1_01a/brocade_mpls_rpc/show_mpls_lsp_extensive/output/lsp/show_mpls_lsp_extensive_info/show_mpls_lsp_sec_path_info/sec_path/lsp_sec_path_config_admin_groups/lsp_admin_group/lsp_admin_group_include_any/__init__.py | 7,563 | Python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sprint.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
from google.protobuf import message as _message
from google.protobuf impo... | 46.699248 | 677 | 0.7564 | [
"Apache-2.0"
] | easyopsapis/easyops-api-python | easy_work_service_sdk/model/topboard/sprint_pb2.py | 6,211 | Python |
from abc import ABC, abstractmethod
from typing import Tuple, Dict
from kloppy.infra.utils import Readable
from kloppy.domain import Dataset
class TrackingDataSerializer(ABC):
@abstractmethod
def deserialize(
self, inputs: Dict[str, Readable], options: Dict = None
) -> Dataset:
raise NotI... | 25.166667 | 63 | 0.719647 | [
"BSD-3-Clause"
] | FCrSTATS/kloppy | kloppy/infra/serializers/tracking/base.py | 453 | Python |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
try:
basestring
except NameError:
basestring = str
import compas_rhino
from compas.utilities import iterable_like
from compas_rhino.artists._primitiveartist import PrimitiveArtist
__all__ = ['LineArt... | 30.62037 | 123 | 0.566979 | [
"MIT"
] | KEERTHANAUDAY/compas | src/compas_rhino/artists/lineartist.py | 3,307 | Python |
# Copyright (C) 2021 Xilinx, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 32.309524 | 100 | 0.733972 | [
"Apache-2.0"
] | Ali-Homsi/githubrepo | setup.py | 1,357 | Python |
# Copyright (C) 2017-2019 Apple Inc. 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 code must retain the above copyright
# notice, this list of conditions and ... | 36.5 | 95 | 0.715922 | [
"BSD-2-Clause"
] | jacadcaps/webkitty | Tools/Scripts/webkitpy/port/device.py | 4,453 | Python |
out = "281 547 54 380 392 98 158 440 724 218 406 672 193 457 694 208 455 745 196 450 724".split(" ")
out = [int(x) for x in out]
exec('def f(x):'+'yield((x:=-~x)*x+-~-x)%727;'*100)
for i in range(727):
g=f(i)
a = (list([*map(lambda c:c^next(g),out)]))
if all([x < 128 for x in a]):
print(i)
print("".join... | 28.583333 | 100 | 0.559767 | [
"MIT"
] | NoXLaw/RaRCTF2021-Challenges-Public | crypto/minigen/solve.py | 343 | Python |
import datetime
from datetime import timedelta
import csv
from module.stock import Stock, Market
# Historic Files
DAX = 'DAX.csv'
DOW = 'Dow.csv'
FTSE = 'FTSE.csv'
# Output File
OUTPUT = 'output.txt'
def import_csv(file_name):
data = []
with open(file_name) as file:
reader = csv.reader(file)
... | 25.761905 | 76 | 0.666359 | [
"MIT"
] | Mooseymax/Market_Simulator | d.py | 1,082 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import flask
from flask import Blueprint, request
import flask_restx as restx
# Add a dummy Resource to verify that the app is properly set.
class HelloWorld(restx.Resource):
def get(self):
return {}
class GoodbyeWorld(restx.Resource):
... | 42.447853 | 81 | 0.655731 | [
"BSD-3-Clause"
] | SteadBytes/flask-restx | tests/legacy/test_api_with_blueprint.py | 6,919 | Python |
#!/usr/bin/python3
import importlib
import os
import getpass
import pip
from crontab import CronTab
if int(pip.__version__.split('.')[0])>9:
from pip._internal import main as pipmain
else:
from pip import main as pipmain
def check_modules():
packages = {"docx" : "python-docx",
"googlea... | 24.018692 | 92 | 0.538521 | [
"Apache-2.0"
] | Jaimedgp/Master-Schedule | src/install.py | 2,570 | Python |
# pyOCD debugger
# Copyright (c) 2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# ... | 35.529412 | 92 | 0.740066 | [
"Apache-2.0"
] | ARMmbed/pyOCD-Samsung | pyocd/target/family/__init__.py | 1,208 | Python |
import argparse
import RDT
import time
import rdt_3_0
def makePigLatin(word):
m = len(word)
vowels = "a", "e", "i", "o", "u", "y"
if m < 3 or word == "the":
return word
else:
for i in vowels:
if word.find(i) < m and word.find(i) != -1:
m = word.find(i)
... | 27.410714 | 80 | 0.565472 | [
"Apache-2.0"
] | AlexHarry17/CSCI466Project2 | submission_files/server_3_0.py | 1,535 | 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.
# C... | 44.132075 | 154 | 0.632322 | [
"Unlicense",
"MIT"
] | amcclead7336/Enterprise_Data_Science_Final | venv/lib/python3.8/site-packages/azure/mgmt/datalake/analytics/catalog/models/usql_external_data_source.py | 2,339 | Python |
# This module just exists as a shortcut for running the main Kivy app
if __name__ == '__main__':
from naturtag.app.app import NaturtagApp
NaturtagApp().run()
| 27.833333 | 69 | 0.730539 | [
"MIT"
] | JWCook/naturtag | naturtag/ui.py | 167 | Python |
from django_filters.rest_framework import DjangoFilterBackend, FilterSet
from rest_framework import generics, viewsets, permissions
from rest_framework import filters
from drf_haystack.viewsets import HaystackViewSet
from drf_haystack.filters import HaystackAutocompleteFilter
from drf_haystack.serializers import Haysta... | 33.565789 | 72 | 0.79459 | [
"MIT"
] | KimHS0915/python-django-patents | api/views.py | 2,551 | Python |
#!C:\Users\John\PycharmProjects\arcadePython\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3.6'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys... | 32.384615 | 70 | 0.672209 | [
"MIT"
] | JohnWJackson/arcadePython | venv/Scripts/pip3.6-script.py | 421 | Python |
from .shell import ShellRunner
from .printonly import PrintOnlyRunner
| 23.333333 | 38 | 0.857143 | [
"Apache-2.0"
] | 7-RED/connectedhomeip | scripts/build/runner/__init__.py | 70 | Python |
from django.db import models
from osc_bge.users import models as user_models
# Create your models here.
class TimeStampedModel(models.Model):
created_at = models.DateTimeField(auto_now_add=True, null=True)
updated_at = models.DateTimeField(auto_now=True, null=True)
class Meta:
abstract = True
#... | 38.696552 | 106 | 0.724826 | [
"MIT"
] | jisuhan3201/osc-bge | osc_bge/agent/models.py | 5,611 | Python |
'''
First Version: Tweets contents from subreddits
'''
from time import sleep
from reddit import Reddit
from twitter import Twitter
def main():
'''
connects the pieces to grab posts from reddit and throw them on twitter
'''
reddit = Reddit()
twitter = Twitter()
tweets = reddit.get_tweets()
... | 22.923077 | 75 | 0.65604 | [
"MIT"
] | seanneal/tweetbot | tweet_bot.py | 596 | Python |
import sys
import json
from rule_gens import RulesForGeneration
from generate_text import generating_player_text_from_templates, generating_team_text_from_templates
from transformers import GPT2Tokenizer
print("Constructing main file ....")
test_preds = []
js = json.load(open(f'./data/jsons/2018_w_opp.json', 'r'))
t... | 27.071429 | 100 | 0.708883 | [
"MIT"
] | ashishu007/data2text-cbr | src/final_gen.py | 1,137 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2017 Matthew Stone <mstone5@mgh.harvard.edu>
# Distributed under terms of the MIT license.
"""
Calculate enrichment of clipped reads or discordant pairs at SV breakpoints.
"""
import argparse
import sys
import pysam
import pandas as pd
from svtk.pesr impor... | 42.688623 | 100 | 0.591948 | [
"BSD-3-Clause"
] | VJalili/gatk-sv | src/svtk/svtk/cli/pesr_test.py | 14,259 | Python |
#!/usr/bin/python3
def lowestPositiveInt(A):
A.sort()
index = -1
try:
index = A.index(1)
except ValueError:
return 1
# Remove all negatives and zero if 1 is found
# if index >= 0:
A = A[index:]
length = len(A)
i = 1
found = 0
while i ... | 20.72093 | 61 | 0.485971 | [
"MIT"
] | gustavoromerobenitez/python-playground | codingTestIterative.py | 891 | Python |
from keras_vggface.utils import preprocess_input
from keras_vggface.vggface import VGGFace
import numpy as np
import pickle
from sklearn.metrics.pairwise import cosine_similarity
import cv2
from mtcnn import MTCNN
from PIL import Image
feature_list = np.array(pickle.load(open('artifacts/extracted_features/embedding.pk... | 28.563636 | 98 | 0.771483 | [
"MIT"
] | entbappy/Which-Bollywood-Celebrity-You-look-like | src/testing.py | 1,571 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.