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 |
|---|---|---|---|---|---|---|---|---|
"""
Tests for Timestamp parsing, aimed at pandas/_libs/tslibs/parsing.pyx
"""
from datetime import datetime
import re
from dateutil.parser import parse
import numpy as np
import pytest
from pandas._libs.tslibs import parsing
from pandas._libs.tslibs.parsing import parse_time_string
import pandas.util._tes... | 29.825328 | 89 | 0.599122 | [
"MIT"
] | OliviaNabbosa89/Disaster_Responses | venv/Lib/site-packages/pandas/tests/tslibs/test_parsing.py | 6,830 | Python |
"""
This file is also being used by the GalaxyCloudRunner (gcr) Docker image.
"""
from getpass import getuser
from multiprocessing import cpu_count
from socket import gethostname
from string import Template
SLURM_CONFIG_TEMPLATE = '''
# slurm.conf file generated by configurator.html.
# Put this file on all nodes of y... | 22.453608 | 81 | 0.800735 | [
"Apache-2.0"
] | Slugger70/pulsar | pulsar/scripts/_configure_slurm.py | 2,178 | Python |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import logging
import numpy as np
from astropy import units as u
from astropy.coordinates import Angle
from astropy.io import fits
from astropy.table import Table
from gammapy.maps import MapAxes, MapAxis
from gammapy.utils.array import array_stats_str
fro... | 32.542169 | 106 | 0.578304 | [
"BSD-3-Clause"
] | mdebony/gammapy | gammapy/irf/psf/gauss.py | 16,206 | Python |
from typing import List
import torch
from torch import Tensor
from hw_asr.base.base_metric import BaseMetric
from hw_asr.base.base_text_encoder import BaseTextEncoder
from hw_asr.metric.utils import calc_cer
class ArgmaxCERMetric(BaseMetric):
def __init__(self, text_encoder: BaseTextEncoder, *args, **kwargs):
... | 41.44 | 116 | 0.668436 | [
"MIT"
] | ArseniyBolotin/asr_project | hw_asr/metric/cer_metric.py | 2,072 | Python |
# We need to make our string alternating, i. e. si≠si+1. When we reverse substring sl…sr,
# we change no more than two pairs sl−1,sl and sr,sr+1. Moreover, one pair should be a
# consecutive pair 00 and other — 11. So, we can find lower bound to our answer as maximum
# between number of pairs of 00 and number of pair... | 36.40625 | 93 | 0.593133 | [
"MIT"
] | Abhinav-22/CompetitiveCode | Codeforces_problems/Reverse Binary Strings/solution.py | 1,173 | Python |
import numpy as np
import cv2
import matplotlib.pylab as plt
from keras.preprocessing.image import load_img
from keras.models import model_from_json
from models import (
create_cam_model, preprocess_image,
get_cam_img
)
# Define CAM conv layer name
CAM_CONV_LAYER = 'cam_conv_layer'
def read_model(model_path, wei... | 25.784 | 97 | 0.730996 | [
"MIT"
] | ijinmao/CAM-Localization | demo.py | 3,223 | Python |
#!/usr/bin/python
"""Plot LFEs of given order parameter."""
import argparse
import sys
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib import gridspec
from matplotlib.ticker import MaxNLocator
import numpy as np
import pandas as pd
from matplotlibstyles import styles
from matplotlibstyles ... | 28.414966 | 96 | 0.625808 | [
"MIT"
] | acumb/LatticeDNAOrigami | scripts/plotting/plot_lfes.py | 4,177 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Fabian Affolter <fabian()affolter-engineering.ch>'
__copyright__ = 'Copyright 2014 Fabian Affolter'
__license__ = """Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"""
HAVE_DBUS=True
try:
import dbus
except ImportError:
... | 32.625 | 98 | 0.649425 | [
"EPL-1.0"
] | daq-tools/mqttwarn | services/dbus.py | 1,566 | Python |
# encoding: utf-8
import datetime
import logging
from ckan.common import config
from six import text_type
from sqlalchemy import Table, select, join, func, and_
import ckan.plugins as p
import ckan.model as model
log = logging.getLogger(__name__)
cache_enabled = p.toolkit.asbool(
config.get('ckanext.stats.cache_... | 32.839286 | 76 | 0.576672 | [
"BSD-3-Clause"
] | 4yjo/ckan | ckanext/stats/stats.py | 3,678 | Python |
import time
import numpy as np
import os.path as osp
import datetime
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.utils.tensorboard import SummaryWriter
import nni
from dassl.data import DataManager
from dassl.optim import build_optimizer, build_lr_scheduler
from dassl.utils import... | 33.30226 | 97 | 0.57015 | [
"MIT"
] | zhaoxin94/Dassl.pytorch | dassl/engine/trainer.py | 23,578 | Python |
import json
import os
import pickle
import requests
import shutil
import tempfile
import uuid
from flask import Blueprint, current_app, jsonify, request, send_file
name = 'HTTP'
prefix = 'http'
storage_enabled = True
global storage_path
plugin = Blueprint(name, __name__)
def register(app, plugin_storage_path=None... | 33.661017 | 101 | 0.630916 | [
"Apache-2.0"
] | radon-h2020/radon-ctt-agent-plugins | http/__init__.py | 5,958 | Python |
from trixi.logger.file.numpyplotfilelogger import NumpyPlotFileLogger
from trixi.logger.file.pytorchplotfilelogger import PytorchPlotFileLogger
from trixi.logger.file.textfilelogger import TextFileLogger
| 51 | 73 | 0.897059 | [
"MIT"
] | comeonfox/trixi | trixi/logger/file/__init__.py | 204 | Python |
"""
Copyright 2021 K.M Ahnaf Zamil
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, publish, distribute, su... | 36.426966 | 460 | 0.677051 | [
"MIT"
] | ahnaf-zamil/pogweb | pogweb/models.py | 3,242 | Python |
from mizarlabs.transformers.technical.rsi import BarArrivalRSIStrategy
from mizarlabs.transformers.technical.rsi import RSIConfirmation
def test_bar_arrival_rsi_strategy_predict(dollar_bar_dataframe):
rsi_upper_threshold = 55
rsi_lower_threshold = 45
bar_arrival_upper_threshold = 0
bar_arrival_lower_t... | 35.174419 | 83 | 0.753719 | [
"MIT"
] | MizarAI/mizar-labs | mizarlabs/tests/transformers/test_rsi.py | 3,025 | Python |
# Scrapy settings for amzASINScrapper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://docs.scrapy.org/en/latest/topics/settings.html
# https://docs.scrapy.org/en/latest/topics/downloader-mi... | 35.460674 | 103 | 0.78327 | [
"MIT"
] | sunil-dhaka/python-webScrappers | amzASINScrapper/amzASINScrapper/settings.py | 3,156 | Python |
"""Test cases around the demo fan platform."""
import pytest
from homeassistant.setup import async_setup_component
from homeassistant.components import fan
from homeassistant.const import STATE_OFF, STATE_ON
from tests.components.fan import common
FAN_ENTITY_ID = 'fan.living_room_fan'
def get_entity(hass):
"""... | 29.050505 | 74 | 0.714882 | [
"Apache-2.0"
] | ActuallyRuben/home-assistant | tests/components/demo/test_fan.py | 2,876 | Python |
from brownie import AdvancedCollectible, network
import pytest
from scripts.advanced_collectible.deploy_and_create import deploy_and_create, get_contract
from scripts.utils.helpful_scripts import LOCAL_BLOCKCHAIN_ENVIRONMENTS, get_account
def test_can_create_advanced_collectible():
if network.show_active() not in... | 48 | 90 | 0.804825 | [
"MIT"
] | Sam44323/nft-mix-opensea | tests/unit/test_advanced_collectible.py | 912 | Python |
# Digital OCEAN FLASK SERVER RECEIVES IMAGE
from flask import Flask, request, jsonify
import classify
import base64
import json
import firebase
import env
# Instantiate Flask
app = Flask(__name__)
# health check
@app.route("/status")
def health_check():
return "Running!"
# Performing image Recognition on Image... | 20.196078 | 71 | 0.691262 | [
"MIT"
] | flamanta/river-trash-detection | app.py | 1,030 | Python |
#!/usr/bin/env python3
import os.path
import tensorflow as tf
import helper
import warnings
from distutils.version import LooseVersion
import project_tests as tests
# Check TensorFlow Version
assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'Please use TensorFlow version 1.0 or newer. You are using {}'.fo... | 41.891892 | 146 | 0.711613 | [
"MIT"
] | papaispicolo/CarNDT3-SemanticSegmentation | main.py | 7,750 | Python |
# Copyright 2015 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... | 34.262295 | 80 | 0.691388 | [
"Apache-2.0"
] | 252125889/tensorflow | tensorflow/python/keras/_impl/keras/datasets/cifar10.py | 2,090 | Python |
"""
Django settings for scannerKH project.
Generated by 'django-admin startproject' using Django 3.0.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
... | 25.651163 | 91 | 0.699003 | [
"MIT"
] | JanGut/scannerKH | scannerKH/scannerKH/settings.py | 3,309 | Python |
from .draw_graph import draw_graph
| 17.5 | 34 | 0.857143 | [
"Apache-2.0"
] | IntelLabs/causality-lab | plot_utils/__init__.py | 35 | Python |
# -*- coding: utf-8 -*-
import scrapy
import re
import json
from locations.hourstudy import inputoutput
class AldiUKSpider(scrapy.Spider):
name = "aldiuk"
allowed_domains = ['www.aldi.co.uk']
start_urls = (
'https://www.aldi.co.uk/sitemap/store',
)
def parse(self, response):
respo... | 39.125 | 159 | 0.571353 | [
"MIT"
] | bealbrown/allhours | locations/spiders/aldi_uk.py | 1,878 | Python |
"""
Django settings for api_drf project.
Generated by 'django-admin startproject' using Django 2.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
#... | 26.570313 | 91 | 0.701558 | [
"MIT"
] | kaparis/spa101 | api_drf/api_drf/settings.py | 3,401 | Python |
# See LICENSE for licensing information.
#
# Copyright (c) 2016-2019 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
import debug
from tech import drc, parameter, sp... | 45.356436 | 118 | 0.697337 | [
"BSD-3-Clause"
] | ckdur/OpenRAM | compiler/characterizer/measurements.py | 9,162 | Python |
from setuptools import find_packages, setup
NAME = "popmon"
MAJOR = 0
REVISION = 3
PATCH = 8
DEV = False
# NOTE: also update version at: README.rst
with open("requirements.txt") as f:
REQUIREMENTS = f.read().splitlines()
# read the contents of abstract file
with open("README.rst", encoding="utf-8") as f:
lo... | 29.633663 | 104 | 0.610758 | [
"MIT"
] | stephanecollot/popmon | setup.py | 2,993 | Python |
import platform
import subprocess
import sys
from optparse import OptionParser
from util import fileLogger
from util import logger
def parse_start_arguments():
parser = OptionParser()
parser.add_option("--unityPath", dest="UnityPath", default=True, help="Path to Unity application")
parser.add_option("--p... | 34.267442 | 141 | 0.657279 | [
"MIT"
] | christian-stockinger/UnityBuilder | UnityBuilder.py | 2,947 | Python |
# -*- coding: utf-8 -*-
"""Access to FAIRsharing via its API.
.. seealso:: https://beta.fairsharing.org/API_doc
"""
from typing import Any, Iterable, Mapping, MutableMapping, Optional
import pystow
import requests
import yaml
from tqdm import tqdm
__all__ = [
"ensure_fairsharing",
"load_fairsharing",
"... | 31.414013 | 98 | 0.59854 | [
"MIT"
] | cthoyt/fairsharing-client | src/fairsharing_client/api.py | 4,932 | Python |
#
# Copyright 2022 DMetaSoul
#
# 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... | 37.715736 | 161 | 0.689367 | [
"Apache-2.0"
] | meta-soul/MetaSpore | demo/search/src/eval/evaluation.py | 7,430 | Python |
"""
Copyright [2021] [DenyS]
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
dist... | 24.470588 | 72 | 0.669872 | [
"Apache-2.0"
] | Animatea/DiscordProgressbar | multibar/core/variants/lib_info.py | 1,248 | Python |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', 'simpleproject.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^simpleapp/', includ... | 26.461538 | 58 | 0.65407 | [
"BSD-2-Clause"
] | Shailendre/simpleproject | simpleproject/simpleproject/urls.py | 344 | Python |
# -*- coding: utf-8 -*-
"""
Demonstrates basic use of LegendItem
"""
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
win = pg.plot()
win.setWindowTitle('pyqtgraph example: BarGraphItem')
# # option1:... | 31.318182 | 126 | 0.646589 | [
"MIT"
] | 3DAlgoLab/pyqtgraph | examples/Legend.py | 1,378 | Python |
class TimedData(object):
"""
Struttura dati per eventi accompagnati da un informazione temporale discreta (timestamp o intervallo)
"""
def __init__(self, data, time, timestamp=True):
"""
I parametri di input sono
- "data": il dato che si vuole memorizzare (di qualsiasi natura)
... | 35.541045 | 111 | 0.586247 | [
"MIT"
] | gavalle94/P2P-Sim | timed_structures.py | 9,525 | Python |
"""
This problem was asked by Amazon.
Given a matrix of 1s and 0s, return the number of "islands" in the matrix.
A 1 represents land and 0 represents water, so an island is a group of 1s
that are neighboring whose perimeter is surrounded by water.
For example, this matrix has 4 islands.
1 0 0 0 0
0 0 1 1 0
0 1 1 0 0... | 21.107527 | 74 | 0.496689 | [
"MIT"
] | RafayAK/CodingPrep | DailyCodingProblem/84_Amazon_Find_Islands_From_Matrix.py | 1,963 | Python |
# The following comments couldn't be translated into the new config version:
# untracked PSet maxEvents = {untracked int32 input = 2}
#include "Configuration/ReleaseValidation/data/Services.cff"
# include "Configuration/StandardSequences/data/FakeConditions.cff"
# untracked PSet options = {
# include "FWC... | 32.965517 | 89 | 0.789749 | [
"Apache-2.0"
] | 4quarks/cmssw | L1Trigger/RegionalCaloTrigger/test/rctInputTest_cfg.py | 1,912 | Python |
from twisted.internet import defer
from signing.processor import expose
class SayHiImplementation(object):
"""
Responds with 'hello, %s' % arg
"""
@expose
def say_hi(self, identifier):
d = defer.Deferred()
d.callback('hello, %s' % identifier)
return d
| 22.846154 | 44 | 0.632997 | [
"Apache-2.0"
] | nkrowlan/signing-server | signing/processorimpl/sayhiimplementation.py | 297 | Python |
from django.urls import path
from . import views
from django.urls import path, include
urlpatterns = [
path('',views.savedata,name="savedata"),
]
| 18.875 | 44 | 0.728477 | [
"MIT"
] | MindMantraSIH/paathshaala | suggestions/urls.py | 151 | Python |
# -*- coding: utf-8 -*-
from collections import namedtuple
from subprocess import check_output
import click
from .utils import cd
try:
from subprocess import call as run
except ImportError:
from subprocess import run
class VueJs(object):
"""
Provide subprocess call to `npm` and `vue-cli`
"""
... | 22.792308 | 82 | 0.600405 | [
"MIT"
] | Timtech4u/python-vuejs | python_vuejs/vuejs.py | 2,963 | Python |
import numpy as np
from PIL import Image, ImageDraw
from scipy import interpolate, ndimage, stats, signal, integrate, misc
from astropy.io import ascii, fits
from astropy.wcs import WCS
from astropy.coordinates import SkyCoord
import astropy.units as u
import astropy.constants as c
import corner as triangle # formerly... | 30.970484 | 116 | 0.564692 | [
"MIT"
] | johnarban/arban | schmidt_funcs.py | 26,232 | Python |
"""A word2vec implementation using Tensorflow and estimators."""
import os
from collections import defaultdict
import logging
import tensorflow as tf
# from tensorflow.python import debug as tf_debug # pylint: disable=E0611
import word2vec.utils.datasets as datasets_utils
import word2vec.models.word2vec as w2v_mod... | 44.950704 | 81 | 0.608491 | [
"MIT"
] | akb89/word2vec | word2vec/estimators/word2vec.py | 6,383 | Python |
from .gui import * | 18 | 18 | 0.722222 | [
"MIT"
] | jakebrehm/ezpz | lemons/__init__.py | 18 | Python |
class Persona:
def __init__(self):
self.edad = 18
self.nombre = "juan"
print "Se ha creado a", self.nombre, "de", self.edad
def hablar(self,palabras ="No se que decir"):
print self.nombre,': ', palabras
juan = Persona()
juan.hablar()
juan.hablar("Hola estoy hablando"... | 24.846154 | 61 | 0.591331 | [
"MIT"
] | gcardosov/PythonAprendeOrg | EjemploMetodos.py | 323 | Python |
import argparse
import collections
import fnmatch
import os.path
import pprint
import re
import sys
#######################
### OSimStatsHelper ###
#######################
class OSimStatsHelper:
"""Takes a list of stats and returns a stat containing their summation by each sample."""
@staticmethod
def sumS... | 38.068627 | 109 | 0.425573 | [
"BSD-3-Clause-Clear"
] | ConnectionMaster/opensimulator-tools | analysis/opensimulator-stats-analyzer/src/osta/osta.py | 7,766 | Python |
import os
import sys
import errno
import random
import pickle
import numpy as np
import torch
import torchvision
import torch.nn.functional as F
from torch.utils.data.dataset import Dataset
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import BatchSampler
from torchvision.datasets imp... | 27.626866 | 79 | 0.562939 | [
"MIT"
] | kaderghal/ADNI_Data_processing | src/pytorch-template/old/models/baseline_3D_single.py | 1,851 | Python |
import oneflow as flow
import oneflow as flow_exp
from oneflow import Tensor
def nms(boxes: Tensor, scores: Tensor, iou_threshold: float) -> Tensor:
scores_inds = flow_exp.argsort(scores, dim=0, descending=True)
boxes = flow._C.gather(boxes, scores_inds, axis=0)
_nms_op = (
flow_exp.builtin_op("nm... | 30.55 | 71 | 0.648118 | [
"Apache-2.0"
] | BakerMara/models | ops/nms.py | 611 | Python |
#!/usr/bin/python
"""Cartesian execution of options for experiments"""
import itertools
from pprint import pprint
import os
# GROUPS = [
# ('train', {'type': 'option',
# 'order': 0,
# 'values': ['train5k']}),
# ('lang', {'type': 'option',
# 'order': 1,
# ... | 43.237288 | 393 | 0.571541 | [
"Apache-2.0"
] | CoNLL-UD-2017/OpenU-NLP-Lab | scripts/cartesian_experiments.py | 5,102 | Python |
# Copyright (c) 2020 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
import garnett
import hoomd
import hoomd.hpmc
# Vertices of a cube
cube_verts = [[-1, -1, -1], [-1, -1, 1], [-1, 1, 1], [-1, 1, -1],
[1, -1, -1], [1, -1, 1], ... | 34.020833 | 77 | 0.644825 | [
"BSD-3-Clause"
] | glotzerlab/garne | examples/example-hpmc.py | 1,633 | Python |
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import json
import xmind
import logging
from xmind2testcase2021.zentao import xmind_to_zentao_csv_file
from xmind2testcase2021.testlink import xmind_to_testlink_xml_file
from xmind2testcase2021.utils import xmind_testcase_to_json_file
from xmind2testcase2021.utils import xmi... | 39.740741 | 95 | 0.741379 | [
"MIT"
] | lovpuss/xmind2testcase2021 | samples.py | 2,152 | Python |
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... | 34.158228 | 116 | 0.564712 | [
"Apache-2.0"
] | UManPychron/pychron | pychron/dvc/meta_repo.py | 21,588 | Python |
#!/usr/bin/python
import glob,re,sys,math,pyfits
import numpy as np
import utils
if len(sys.argv) < 2:
print '\nconvert basti SSP models to ez_gal fits format'
print 'Run in directory with SED models for one metallicity'
print 'Usage: convert_basti.py ez_gal.ascii\n'
sys.exit(2)
fileout = sys.argv[1]... | 30.545455 | 112 | 0.657738 | [
"MIT"
] | dpgettings/ezgal | ezgal/scripts/convert_basti.py | 4,032 | Python |
import path4gmns as pg
from time import time
def test_download_sample_data_sets():
pg.download_sample_data_sets()
def test_find_shortest_path():
load_demand = False
network = pg.read_network(load_demand)
print('\nshortest path (node id) from node 1 to node 2, '
+network.find_shortest_path... | 34.529412 | 79 | 0.678179 | [
"Apache-2.0"
] | FangTang999/Path4GMNS | tests/demo.py | 6,457 | Python |
"""Define family of algorithms and make them interchangeable
The algorithms vary independetly from the clients using it.
This class implements to IngestorInterface and dynamically invoke
a suitable algorithm (strategy.algorithm()), through parse()
abstract method. i.e. it is independent of how an algorithm
is im... | 34.472222 | 79 | 0.759871 | [
"MIT"
] | 1ayham1/Data_Science-DynamicMemes_-generator | QuoteEngine/Ingestor.py | 1,241 | Python |
from infoblox_netmri.utils.utils import locate, to_snake
from infoblox_netmri.api.exceptions.netmri_exceptions import NotImplementedException
class Broker(object):
""" Base class for broker instances, provides methods for API requests.
And return responces wrapped with specific class
:param client... | 34.172727 | 85 | 0.623304 | [
"Apache-2.0"
] | IngmarVG-IB/infoblox-netmri | infoblox_netmri/api/broker/broker.py | 3,759 | Python |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | 46.175824 | 77 | 0.642789 | [
"Apache-2.0"
] | AymericDu/swift | swift/proxy/controllers/account.py | 8,404 | Python |
"""
ASGI config for backend project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault(... | 23.941176 | 79 | 0.7543 | [
"MIT"
] | CSXL/csxlabs.org | backend/backend/asgi.py | 407 | Python |
from thriftpy2.thrift import TType
class ThriftError(Exception):
""" Base Exception defined by `aiothrift` """
class ConnectionClosedError(ThriftError):
"""Raised if connection to server was closed."""
class PoolClosedError(ThriftError):
"""Raised when operating on a closed thrift connection pool"""
... | 26.444444 | 66 | 0.633053 | [
"MIT"
] | achimnol/aiothrift | aiothrift/errors.py | 1,428 | Python |
"""
From https://zenodo.org/record/3539363
"""
import re
def section_text(text):
"""Splits text into sections.
Assumes text is in a radiology report format, e.g.:
COMPARISON: Chest radiograph dated XYZ.
IMPRESSION: ABC...
Given text like this, it will output text from each section, ... | 39.59854 | 79 | 0.589677 | [
"MIT"
] | philip-mueller/lovt | src/data/datasets/mimic_cxr/section_parser.py | 10,850 | Python |
# SVG Path specification parser
import re
from . import path
COMMANDS = set('MmZzLlHhVvCcSsQqTtAa')
UPPERCASE = set('MZLHVCSQTA')
COMMAND_RE = re.compile("([MmZzLlHhVvCcSsQqTtAa])")
FLOAT_RE = re.compile("[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?")
def _tokenize_path(pathdef):
for x in COMMAND_RE.split(pathdef)... | 36.188482 | 85 | 0.54702 | [
"MIT"
] | judithfan/sketch-rnn | svg/path/parser.py | 6,912 | Python |
from circularImportA import a
def f():
print(a)
b = 2
| 8.571429 | 29 | 0.633333 | [
"MIT"
] | Daniel-Chin/mini-Python | experiments/circularImportB.py | 60 | Python |
from ._visible import VisibleValidator
from ._valuesuffix import ValuesuffixValidator
from ._valueformat import ValueformatValidator
from ._uid import UidValidator
from ._textfont import TextfontValidator
from ._stream import StreamValidator
from ._showlegend import ShowlegendValidator
from ._selectedpoints import Sele... | 39.875 | 52 | 0.879833 | [
"MIT"
] | Dexter2772/bitcoin-tracker | myvenv/lib/python3.7/site-packages/plotly/validators/sankey/__init__.py | 957 | Python |
# -*- coding: utf-8 -*-
from tests.integration import TestsBase
from chsdi.models.bod import Catalog
from sqlalchemy.orm import scoped_session, sessionmaker
from chsdi.views.catalog import create_digraph
from chsdi.lib.filters import filter_by_geodata_staging
class TestCatalogService(TestsBase):
def test_nodes_... | 44.072368 | 128 | 0.587252 | [
"BSD-3-Clause"
] | fredj/mf-chsdi3 | tests/integration/test_catalog.py | 6,699 | Python |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | 55.238994 | 96 | 0.669703 | [
"Apache-2.0"
] | neubloc/elasticsearch-py | elasticsearch/_sync/client/text_structure.py | 8,785 | Python |
"""
Tests for the utils module
"""
import datetime
import operator as op
from math import ceil
from types import SimpleNamespace
import pytest
import pytz
from mitol.common.utils import (
is_near_now,
has_equal_properties,
first_or_none,
first_matching_item,
max_or_none,
partition_to_lists,
... | 30.435159 | 113 | 0.648802 | [
"BSD-3-Clause"
] | mitodl/bootcamp-ecommerce | main/utils_test.py | 10,561 | Python |
"""
Test admin tools
"""
from io import BytesIO, TextIOWrapper
import csv
import six
import zipfile
import django
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.test import Client, TestCase
import gdpr_assist
from .gdpr_assist_tests_app.factories... | 33.171975 | 96 | 0.569796 | [
"BSD-3-Clause"
] | minervaproject/django-gdpr-assist | tests/test_admin.py | 10,416 | 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 us... | 39.605304 | 97 | 0.697483 | [
"Apache-2.0"
] | AhnLab-OSS/beam | sdks/python/apache_beam/io/textio.py | 25,387 | Python |
import os
import click
from flask import Flask, render_template
from flask_wtf.csrf import CSRFError
from telechat.extensions import db, login_manager, csrf, moment
from telechat.blueprints.auth import auth_bp
from telechat.blueprints.chat import chat_bp
from telechat.blueprints.admin import admin_bp
from telechat.bl... | 28.336957 | 92 | 0.693901 | [
"MIT"
] | Sefank/telechat | telechat/__init__.py | 3,161 | Python |
from django.urls import path
from . import views
app_name = 'partners'
urlpatterns = [
path('registerCampusPartner/', views.registerCampusPartner, name='registerCampusPartner'),
path('registerCommunityPartner/', views.registerCommunityPartner, name='registerCommunityPartner'),
path('profile/userprofile/... | 47.384615 | 104 | 0.761364 | [
"MIT"
] | Goutham2591/mav-cpi | partners/urls.py | 616 | Python |
"""Configuration format loaders"""
import locale
import os
from abc import ABC, abstractmethod
import yaml
from pydantic import create_model
def load_configuration(configuration_file_path, parameters_file_path, bundles):
"""Combines the configuration and parameters and build the configuration object"""
mappin... | 38.674699 | 119 | 0.65109 | [
"Apache-2.0"
] | applauncher-team/applauncher | applauncher/configuration.py | 3,210 | Python |
from sqlalchemy import and_
from sqlalchemy import exc
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import INT
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import Sequence
from sqlalchemy import sql
from sqlalchemy import String
from sqlalchemy import t... | 30.968504 | 79 | 0.515446 | [
"MIT"
] | AngelLiang/hacking-sqlalchemy | test/sql/test_insert_exec.py | 15,732 | Python |
import re
import connexion
import logging
import auslib
from os import path
from flask import request
from flask_compress import Compress
from auslib.web.admin.views.problem import problem
from auslib.web.admin.views.validators import BalrogRequestBodyValidator
from raven.contrib.flask import Sentry
from specsynthase.... | 33.913978 | 116 | 0.737793 | [
"MPL-2.0"
] | catlee/balrog | auslib/web/admin/base.py | 3,154 | Python |
# -*- coding: utf-8 -*-
# FLEDGE_BEGIN
# See: http://fledge.readthedocs.io/
# FLEDGE_END
""" Test end to end flow with:
Notification service with
Threshold in-built rule plugin
notify-python35 delivery channel plugin
"""
import os
import time
import subprocess
import http.client
import json
f... | 41.973214 | 119 | 0.657307 | [
"Apache-2.0"
] | YashTatkondawar/fledge | tests/system/python/e2e/test_e2e_notification_service_with_plugins.py | 14,103 | Python |
# coding: utf-8
# ... import symbolic tools
weak_formulation = load('pyccel.symbolic.gelato', 'weak_formulation', True, 2)
glt_function = load('pyccel.symbolic.gelato', 'glt_function', True, 3)
Grad = load('pyccel.symbolic.gelato', 'Grad', False, 1)
Curl = load('pyccel.symbolic.gelato', 'Curl', False, 1)
... | 25.901961 | 78 | 0.549584 | [
"MIT"
] | toddrme2178/pyccel | src_old/tests/scripts/lambda/pdes/2d/ex10.py | 1,321 | Python |
from py12306.log.base import BaseLog
from py12306.helpers.func import *
@singleton
class OrderLog(BaseLog):
# 这里如果不声明,会出现重复打印,目前不知道什么原因
logs = []
thread_logs = {}
quick_log = []
MESSAGE_REQUEST_INIT_DC_PAGE_FAIL = '请求初始化订单页面失败'
MESSAGE_SUBMIT_ORDER_REQUEST_FAIL = '提交订单失败,错误原因 {} \n'
MESS... | 45.191781 | 109 | 0.614429 | [
"Apache-2.0"
] | 1182836912/py12306 | py12306/log/order_log.py | 3,989 | Python |
from setuptools import setup, find_packages
def read_requirements():
with open('requirements.txt') as req:
content = req.read()
requirements = content.split('\n')
return requirements
classifiers = [
'Topic :: Security',
'Development Status :: 4 - Beta',
'Environment :: Console',
... | 28.803922 | 132 | 0.641933 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | devqueue/Skyhawk-cli | setup.py | 1,469 | Python |
""" DarkWorldsMetricMountianOsteric.py
Custom evaluation metric for the 'Observing Dark Worlds' competition.
[Description of metric, or reference to documentation.]
Update: Made for the training set only so users can check there results from the training c
@Author: David Harvey
Created: 22 August 2012
"""
import nu... | 46.896313 | 188 | 0.604284 | [
"MIT"
] | 19shanu91/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter5_LossFunctions/DarkWorldsMetric.py | 20,353 | Python |
#!/usr/bin/env python3
# methodological_experiment.py
import sys, os, csv
import numpy as np
import pandas as pd
import versatiletrainer2
import metaselector
import matplotlib.pyplot as plt
from scipy import stats
def first_experiment():
sourcefolder = '../data/'
metadatapath = '../metadata/mastermetadata... | 44.895954 | 360 | 0.629168 | [
"MIT"
] | tedunderwood/fiction | variation/methodological_experiment.py | 31,068 | Python |
# Copyright 2018 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... | 34.530303 | 80 | 0.678806 | [
"Apache-2.0"
] | CelineQiQi/lingvo | lingvo/core/ops/random_ops_test.py | 2,279 | 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 PyFastjsonschema(PythonPackage):
"""Fast JSON schema validator for Python."""
homepage = "https://github.c... | 34.8125 | 96 | 0.759425 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | Bambi/spack | var/spack/repos/builtin/packages/py-fastjsonschema/package.py | 557 | Python |
import pytest
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from django.contrib.auth.models import User
from records.models import (
Category, Record, Budget, OUTCOME, INCOME, SAVINGS, tmz)
from records.month_control import MonthControl, MonthControlWithBudget
@pytest.fixt... | 24.389423 | 78 | 0.723044 | [
"Unlicense"
] | curaloucura/money-forecast | moneyforecast/tests/records/fixtures.py | 5,073 | Python |
with open("/cvmfs/cms.cern.ch/phys_generator/gridpacks/slc6_amd64_gcc481/13TeV/madgraph/GMSB_SHLA/GMSB_Lambda350TeV_CTau400cm.slha") as f:
SLHA_TABLE = f.read()
import FWCore.ParameterSet.Config as cms
from Configuration.Generator.Pythia8CommonSettings_cfi import *
from Configuration.Generator.MCTunes2017.PythiaCP5... | 42.911765 | 138 | 0.632625 | [
"Apache-2.0"
] | zhangzc11/cms-gmsb-sps8-configs | Configuration/GenProduction/python/ThirteenTeV/GMSB_noSLHA/GMSB_L350TeV_Ctau400cm_Pythia8_13TeV_cff.py | 1,459 | Python |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_object('setting')
db = SQLAlchemy(app) | 17.875 | 39 | 0.797203 | [
"MIT"
] | vemodalen-x/IRS_imental | Systemcode/imental-Flask/init.py | 143 | Python |
'''Ask two student's grade, inform 3 possible averages.
average :
> 7 = Approved
< 7 & > 5 = Recovery
< 5 = Failed
'''
g1 = float(input("Inform the student's first grade: "))
g2 = float(input("Inform the student's second grade: "))
average = (g1 + g2)/2 # how to calculate the avarege grade between two values
if averag... | 38.4375 | 82 | 0.687805 | [
"MIT"
] | engcristian/Python | Python-codes-CeV/40-Average.py | 615 | Python |
from helpers.language import estr
ACTION_TEXT = "text"
ACTION_TEXT_QUESTION = "text_question"
ACTION_LIST_QUESTION = "list_question"
ACTION_YES_NO_QUESTION = "yesno_question"
ACTION_CHOICES_QUESTION = "choices_question"
ID = "id"
NO = "no"
YES = "yes"
TEXT = "text"
ON_NO = "on_no"
ON_YES = "on_yes"
ACTION = "action"
... | 32.342222 | 120 | 0.588292 | [
"MIT"
] | R-Mielamud/Telegram_BooksDelivery | src/helpers/conversation.py | 7,277 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# File:
import numpy as np
import unittest
import torch
from detectron2.data import MetadataCatalog
from detectron2.structures import Instances, RotatedBoxes, BoxMode
from detectron2.utils.visualizer import Visualizer
cla... | 40.402985 | 96 | 0.602143 | [
"Apache-2.0"
] | HJ0116/detectron2 | tests/test_visualizer.py | 5,414 | Python |
from selenium.webdriver.common.by import By
# for maintainability we can seperate web objects by page name
class MainPageLocators(object):
LOGO = (By.ID, 'nav-logo')
ACCOUNT = (By.ID, 'nav-link-accountList')
SIGNUP = (By.CSS_SELECTOR, '#nav-signin-tooltip > div > a')
LOGIN = (By.CSS_SELECTOR, '#nav-s... | 32.95 | 81 | 0.6783 | [
"MIT"
] | gunesmes/page-object-python-selenium | utils/locators.py | 659 | Python |
#
# builder.py - PJSIP test scenarios builder
#
# Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
... | 35.695219 | 100 | 0.53686 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | MathJud/qaul.net_legacy | pjproject-2.2.1/tests/cdash/builder.py | 17,919 | Python |
import copy
import gym
import numpy as np
import torch.nn as nn
import railrl.misc.hyperparameter as hyp
import railrl.torch.pytorch_util as ptu
from railrl.data_management.obs_dict_replay_buffer import \
ObsDictReplayBuffer
from railrl.launchers.launcher_util import run_experiment
# from railrl.samplers.data_col... | 29.973333 | 95 | 0.632006 | [
"MIT"
] | Asap7772/rail-rl-franka-eval | experiments/avi/eric_grasp_sac_pixel.py | 8,992 | Python |
from __future__ import print_function
import datetime
import hashlib
import logging
from abc import ABCMeta
from halo_flask.classes import AbsBaseClass
from halo_flask.logs import log_json
from halo_flask.const import SYSTEMChoice,LOGChoice
from .settingsx import settingsx
settings = settingsx()
logger = logging.... | 28.584906 | 123 | 0.611881 | [
"MIT"
] | yoramk2/halo_flask | halo_flask/models.py | 1,515 | Python |
av1 = float(input('Nota 1° avaliação'))
av2 = float(input('Nota 2° avaliação'))
mp = av1 + av2 / 2
tf = int(input('Total geral de faltas: ')
pf = float(input('Prova final: '))
final = mp + pf / 2
if tf > 20:
print("Reprovado por falta")
else
elif mp => 7:
print("Aprovado")
elif 3 <= mp < 7:
... | 19.681818 | 41 | 0.558891 | [
"MIT"
] | sullyvan15/UVV | 4° Período/Programação de Computadores/lista 1/CONCEITOS DE LÓGICA DE PROGRAMAÇÃO/Estrutura de seleção/Exercício 14.py | 441 | Python |
"""
.. module:: Katna.image_filters.text_detector
:platform: OS X
:synopsis: This module is implementation of text detector filter
"""
import os
import cv2
import numpy as np
import time
import requests
import random
from imutils.object_detection import non_max_suppression
from Katna.image_filters.filter impor... | 40.058608 | 117 | 0.59263 | [
"MIT"
] | jibinmathew69/katna | Katna/image_filters/text_detector.py | 10,936 | Python |
from distutils.core import setup
extra_requires = {
'celery': ["celery[redis]"],
'flower': ["flower"]
}
setup(name="terra",
packages=["terra"],
description="Terra",
extra_requires=extra_requires,
install_requires=[
"pyyaml",
"jstyleson",
# I use signal and task from... | 19.55 | 59 | 0.578005 | [
"MIT"
] | VisionSystemsInc/terra | setup.py | 391 | Python |
from lightning_conceptnet.uri import concept_uri
from wordfreq import simple_tokenize
from wordfreq.preprocess import preprocess_text
STOPWORDS = [
'the', 'a', 'an'
]
DROP_FIRST = ['to']
def english_filter(tokens):
"""
Given a list of tokens, remove a small list of English stopwords.
"""
non_st... | 34.042857 | 79 | 0.684431 | [
"Apache-2.0"
] | ldtoolkit/lightning-conceptnet | lightning_conceptnet/nodes.py | 2,392 | Python |
# Copyright 2014 DreamHost, 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... | 29.790368 | 77 | 0.641308 | [
"Apache-2.0"
] | dreamhost/akanda-horizon | akanda/horizon/api/neutron_extensions_client.py | 10,516 | Python |
"""Django models utilities."""
#Django
from django.db import models
class CRideModel(models.Model):
"""
CrideModel acts as an abastract base class from
which every other model in the project will inherit.
This class provides every table with de following
attributes:
+ created (Datetime): s... | 29.771429 | 78 | 0.649712 | [
"MIT"
] | Jonulo/dejango-adv | cride/utils/models.py | 1,042 | Python |
#!/usr/bin/env python3
# Copyright 2019, Alex Wiens <awiens@mail.upb.de>, Achim Lösch <achim.loesch@upb.de>
# SPDX-License-Identifier: BSD-2-Clause
import os
import os.path
import subprocess
import test as schedtest
import plot
def hostname():
return subprocess.getoutput("hostname")
if __name__ == "__main__":
c... | 23.448276 | 92 | 0.726471 | [
"BSD-2-Clause"
] | aw32/sched | scripts/report_gen.py | 681 | Python |
# Copyright 2012-2017 The Meson development team
# 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 agree... | 42.758204 | 183 | 0.610474 | [
"Apache-2.0"
] | jmesmon/meson | mesonbuild/build.py | 99,028 | Python |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... | 28.867058 | 118 | 0.61085 | [
"MIT"
] | Astrea49/enhanced-discord.py | discord/utils.py | 29,531 | Python |
# Implements I/O over asynchronous sockets
from time import time
from sys import exc_info
from traceback import format_exception
from asyncore import socket_map
from asyncore import loop
from pysnmp.carrier.base import AbstractTransportDispatcher
from pysnmp.error import PySnmpError
class AsyncoreDispatcher(AbstractTr... | 37.325581 | 93 | 0.685358 | [
"Apache-2.0"
] | ArthurKamalov/scalyr-agent-2 | scalyr_agent/third_party/pysnmp/carrier/asyncore/dispatch.py | 1,605 | Python |
import tensorflow as tf
import os
import sklearn.metrics
import numpy as np
import sys
import math
import time
from . import framework
import network
class policy_agent(framework.re_model):
def __init__(self, train_data_loader, batch_size, max_length=120):
framework.re_model.__init__(self, train_data_loade... | 46.525692 | 231 | 0.572084 | [
"MIT"
] | qingdujun/manual-nre | nrekit/rl.py | 11,771 | Python |
import _plotly_utils.basevalidators
class CmaxValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name='cmax',
parent_name='scattergl.marker.line',
**kwargs
):
super(CmaxValidator, self).__init__(
plotly_name=plotly_name,
... | 24.2 | 66 | 0.584711 | [
"MIT"
] | Elpiro/plotly.py | plotly/validators/scattergl/marker/line/_cmax.py | 484 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.