content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
from typing import Optional
from ..category import Category
class Utils(Category):
def check_link(
self,
url: str = None,
**kwargs
) -> dict:
return self._request("checkLink", locals())
def delete_from_last_shortened(
self,
key: ... | 23.390625 | 65 | 0.560454 | [
"MIT"
] | UT1C/pyVDK | pyvdk/api/categories/utils.py | 1,497 | Python |
from pynzb.base import BaseETreeNZBParser, NZBFile, NZBSegment
try:
from lxml import etree
except ImportError:
raise ImportError("You must have lxml installed before you can use the " +
"lxml NZB parser.")
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
c... | 29.875 | 78 | 0.732218 | [
"BSD-3-Clause"
] | DavidM42/pynzb | pynzb/lxml_nzb.py | 478 | Python |
#
# PySNMP MIB module SNMP-MPD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMP-MPD-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:08:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | 132.041667 | 921 | 0.778321 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp-with-texts/SNMP-MPD-MIB.py | 6,338 | Python |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | 34.84127 | 77 | 0.648064 | [
"Apache-2.0"
] | VictoriaRoux/oppia | core/domain/rule_domain_test.py | 4,390 | Python |
from __future__ import division, print_function, absolute_import
# noinspection PyUnresolvedReferences
from six.moves import range
import numpy as np
from scipy.misc import doccer
from ...stats import nonuniform
from ...auxiliary.array import normalize, nunique, accum
__all__ = ['markov']
_doc_default_callparams =... | 27.236181 | 117 | 0.606827 | [
"MIT"
] | evenmarbles/mlpy | mlpy/stats/models/_basic.py | 5,420 | Python |
# Copyright 2017 Battelle Energy Alliance, 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 ... | 36.917722 | 112 | 0.677353 | [
"Apache-2.0"
] | archmagethanos/raven | framework/TSA/PolynomialRegression.py | 5,833 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2014-10-26 13:02:58
# @Author : yml_bright@163.com
from sqlalchemy import Column, String, Integer
from sqlalchemy.ext.declarative import declarative_base
from db import dbengine, Base
class User(Base):
__tablename__ = 'user'
cardnum = Column(String(1... | 35.857143 | 56 | 0.713147 | [
"MIT"
] | HeraldStudio/herald_auth | mod/models/user.py | 753 | Python |
import torch
import torch.nn as nn
def clip_by_tensor(t, t_min, t_max):
result = (t>=t_min)*t+(t<t_min)*t_min
result = (result<=t_max)*result+(result>t_max)*t_max
return result
class FocalLoss(nn.Module):
def __init__(self, gamma=2, alpha=0.25):
super(FocalLoss, self).__init__()
self... | 46.897959 | 122 | 0.639252 | [
"Apache-2.0"
] | 86236291/MSAN_Retina | utils/FocalLoss.py | 2,302 | Python |
# Generated by Django 2.2.2 on 2019-07-18 19:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('weblog', '0011_auto_20190718_1829'),
]
operations = [
migrations.AddField(
model_name='userdetail',
name='phone',
... | 21.526316 | 73 | 0.606357 | [
"MIT"
] | mmohajer9/Resumo | weblog/migrations/0012_userdetail_phone.py | 409 | Python |
import csv
import itertools
import sys
import re
import math
def get_root_mean_square( mean_square, number):
return math.sqrt(mean_square / number)
def gpsr_tlm_compare(target_arr, answer_arr, lift_off_time, fileobj, csv_header):
cache_idx = 0
sim_data_list = []
start_flight_idx = 0
iter_idx = 0
... | 41.968254 | 127 | 0.580938 | [
"BSD-3-Clause"
] | cihuang123/Next-simulation | utilities/log_parser/parser_utility.py | 2,644 | Python |
from databroker.v1 import from_config
from databroker.v0 import Broker
from .. import load_config
name = 'tes'
v0_catalog = Broker.from_config(load_config(f'{name}/{name}.yml'))
v1_catalog = from_config(load_config(f'{name}/{name}.yml'))
catalog = from_config(load_config(f'{name}/{name}.yml')).v2
| 33.222222 | 66 | 0.755853 | [
"BSD-3-Clause"
] | NSLS-II/nsls2-catalogs | nsls2_catalogs/tes/__init__.py | 299 | Python |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... | 28.602941 | 91 | 0.698715 | [
"Apache-2.0"
] | Multiscale-Genomics/mg-rest-file | tests/test_rest_file_region.py | 1,945 | Python |
import asyncio
import io
import time
from firebot import CMD_HELP
from firebot.utils import edit_or_reply, fire_on_cmd, sudo_cmd
@fire.on(fire_on_cmd(pattern="bash ?(.*)"))
@fire.on(sudo_cmd(pattern="bash ?(.*)", allow_sudo=True))
async def _(event):
if event.fwd_from:
return
PROCESS_RUN_TIME = 100
... | 29.947368 | 118 | 0.596368 | [
"MIT"
] | Anju56/Fire-X | firebot/modules/bash.py | 1,707 | Python |
# Demo Python Datetime - The strftime() Method
'''
The strftime() Method
The datetime object has a method for formatting date objects into readable strings.
The method is called strftime(), and takes one parameter, format, to specify the format of the returned string.
Directive Description ... | 57.333333 | 111 | 0.354236 | [
"MIT"
] | luis2ra/py3-00-w3schools | 0-python-tutorial/25-dates05_strftime23_z.py | 2,408 | Python |
from abc import ABC, abstractmethod
from status import Status
class State(ABC):
def __init__(self, turret_controls, body_controls, status: Status):
self.turret_controls = turret_controls
self.body_controls = body_controls
self.status = status
@abstractmethod
def perform(self):
... | 23.444444 | 71 | 0.699052 | [
"MIT"
] | Iain530/do-you-have-the-guts2018 | src/states/state.py | 422 | Python |
class Solution(object):
# def findKthLargest(self, nums, k):
# """
# :type nums: List[int]
# :type k: int
# :rtype: int
# """
# return sorted(nums, reverse=True)[k - 1]
# def findKthLargest(self, nums, k):
# # build min heap
# heapq.heapify(nums)
... | 31.439024 | 73 | 0.501939 | [
"MIT"
] | CZZLEGEND/leetcode-2 | python/215_Kth_Largest_Element_in_an_Array.py | 1,289 | Python |
from itertools import islice
from tests.unit.utils import Teardown
import inspect
import pytest
import time
import cbpro.messenger
import cbpro.public
import cbpro.private
class TestPrivateClient(object):
def test_private_attr(self, private_client):
assert isinstance(private_client, cbpro.public.PublicC... | 35.038062 | 75 | 0.693067 | [
"MIT"
] | Casaplaya/coinbasepro-python | tests/unit/test_private.py | 10,126 | Python |
from __future__ import unicode_literals
from django.db import models
from timezone_field import TimeZoneField
class FakeModel(models.Model):
tz = TimeZoneField()
tz_opt = TimeZoneField(blank=True)
tz_opt_default = TimeZoneField(blank=True, default='America/Los_Angeles')
| 23.916667 | 77 | 0.787456 | [
"BSD-2-Clause"
] | ambitioninc/django-timezone-field | timezone_field/tests/models.py | 287 | Python |
"""Configuration for reproducing leaderboard of grb-citeseer dataset."""
import torch
import torch.nn.functional as F
from grb.evaluator import metric
model_list = ["gcn",
"gcn_ln",
"gcn_at",
"graphsage",
"graphsage_ln",
"graphsage_at",
... | 39.193015 | 100 | 0.463862 | [
"MIT"
] | sigeisler/grb | pipeline/configs/grb-citeseer/config.py | 21,321 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
module: sns_topic
short_description: Manages A... | 39.256654 | 162 | 0.638239 | [
"MIT"
] | DiptoChakrabarty/nexus | venv/lib/python3.7/site-packages/ansible_collections/community/aws/plugins/modules/sns_topic.py | 20,649 | 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 ... | 34.71875 | 91 | 0.633663 | [
"MIT"
] | v-Ajnava/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/wait_for_primary_placement_safety_check.py | 1,111 | Python |
#Shows data from the first 1000 blocks
import random
import os
import subprocess
import json
#Set this to your raven-cli program
cli = "raven-cli"
#mode = "-testnet"
mode = ""
rpc_port = 8746
#Set this information in your raven.conf file (in datadir, not testnet3)
rpc_user = 'rpcuser'
rpc_pass = 'rpcpass555'
def ... | 24.391304 | 75 | 0.703209 | [
"MIT"
] | Clotonervo/TestCoin | assets/tools/blockfacts.py | 1,122 | Python |
"""
Distribution class
"""
# To do:
#
# - wrap bins for cyclic histograms
# - check use of float() in count_mag() etc
# - clarify comment about negative selectivity
#
# - function to return value in a range (like a real histogram)
# - cache values
# - assumes cyclic axes start at 0: include a shift based on range
#
# -... | 35.28449 | 107 | 0.624888 | [
"BSD-3-Clause"
] | fcr/featuremapper | featuremapper/distribution.py | 41,177 | Python |
import logging
import sys
import re
import time
import random
import utils
logger = utils.loggerMaster('slack.lexicon')
def response(type):
phrases={'greetings':[", welcome back", "Hi there", "Good to see you again", "Hello again", "hi"],
'farewells':['bye']
}
try:
length=len(phrases[typ... | 18.617647 | 102 | 0.649289 | [
"MIT"
] | philipok-1/raspberry-slack | lexicon.py | 633 | Python |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: v1.0
@author: Shijie Qin
@license: Apache Licence
@contact: qsj4work@gmail.com
@site: https://shijieqin.github.io
@software: PyCharm
@file: __init__.py.py
@time: 2018/11/8 3:13 PM
"""
| 17.928571 | 35 | 0.669323 | [
"Apache-2.0"
] | shijieqin/flatfish | core/__init__.py | 251 | Python |
"""
Bilinear Attention Networks
Jin-Hwa Kim, Jaehyun Jun, Byoung-Tak Zhang
https://arxiv.org/abs/1805.07932
This code is written by Jin-Hwa Kim.
"""
import sys
sys.path.append('./ban')
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.weight_norm import weight_norm
from attention i... | 36.00885 | 124 | 0.617842 | [
"MIT"
] | szzexpoi/AiR | AiR-M/ban/base_model.py | 8,138 | Python |
import versioneer
commands = versioneer.get_cmdclass().copy()
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
setup(
name='ngenix-test',
version=versioneer.get_version(),
packages=find_packages(),
url='https://git... | 26.241379 | 53 | 0.65703 | [
"MIT"
] | adalekin/ngenix-test | setup.py | 761 | Python |
"""Tag the sandbox for release, make source and doc tarballs.
Requires Python 2.6
Example of invocation (use to test the script):
python makerelease.py --force --retag --platform=msvc6,msvc71,msvc80,mingw -ublep 0.5.0 0.6.0-dev
Example of invocation when doing a release:
python makerelease.py 0.5.0 0.6.0-dev... | 41.059621 | 124 | 0.620883 | [
"MIT"
] | csyzzkdcz/WrinkledTensionFields | external/jsoncppWrapper/makerelease.py | 15,151 | Python |
"""
Getting started tutorial
========================
In this introductory example, you will see how to use the :code:`spikeinterface` to perform a full electrophysiology analysis.
We will first create some simulated data, and we will then perform some pre-processing, run a couple of spike sorting
algorithms, inspect ... | 44.669039 | 126 | 0.654557 | [
"MIT"
] | Dradeliomecus/spikeinterface | examples/getting_started/plot_getting_started.py | 12,555 | Python |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | 33.705856 | 194 | 0.522472 | [
"EPL-1.0"
] | arunpillaii/TACTIC | src/tactic/ui/filter/filter_element_wdg.py | 74,827 | Python |
"""This module contains the general information for BiosVfExecuteDisableBit ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class BiosVfExecuteDisableBitConsts:
SUPPORTED_BY_DEFAULT_NO = "no"
SUPPORTED_BY_DEFAULT_YES = ... | 57.789474 | 287 | 0.687007 | [
"Apache-2.0"
] | Curlyfingers/ucsmsdk | ucsmsdk/mometa/bios/BiosVfExecuteDisableBit.py | 3,294 | Python |
"""
MIT License
Copyright (c) 2021 TheHamkerCat
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, ... | 36.888889 | 78 | 0.705823 | [
"MIT"
] | TAMILVIP007/WilliamButcherBot | wbb/modules/webss.py | 1,992 | Python |
import tweepy
from .config import Config
def update_twitter_banner(api: tweepy.API) -> None:
"""Update the twitter banner of the current profile using the image specified in config."""
api.update_profile_banner(Config.IMAGE_PATH)
| 26.777778 | 95 | 0.767635 | [
"MIT"
] | janaSunrise/Spotify-Twitter-Banner | app/twitter.py | 241 | Python |
from torch.optim.lr_scheduler import LambdaLR
from transformers import get_linear_schedule_with_warmup
from exp import ex
def get_no_scheduler(optimizer, num_warmup_steps, num_training_steps):
def lr_lambda(current_step):
return 1
return LambdaLR(optimizer, lr_lambda)
sched_dict = {
... | 27.615385 | 79 | 0.747911 | [
"MIT"
] | HS-YN/PanoAVQA | code/optimizer/schedulers.py | 718 | 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... | 53.00678 | 1,676 | 0.703716 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/python/pulumi_azure_native/documentdb/v20210615/private_endpoint_connection.py | 15,637 | Python |
# Copyright (c) 2017 Rocky Bernstein
"""
Parsing for a trepan2/trepan3k debugger
"breakpoint', "list", or "disasm" command arguments
This is a debugger location along with:
- an optional condition parsing for breakpoints commands
- a range or count for "list" commands
"""
from __future__ import print_function
imp... | 29.98008 | 82 | 0.562791 | [
"MIT"
] | rocky/python-spark | example/gdb-loc/gdbloc/parser.py | 7,525 | 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... | 40.310345 | 96 | 0.775021 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 312day/airflow | airflow/contrib/hooks/gcp_cloud_build_hook.py | 1,169 | Python |
"""woqlClient.py
WOQLClient is the Python public API for TerminusDB"""
import copy
import gzip
import json
import os
import urllib.parse as urlparse
import warnings
from collections.abc import Iterable
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Union
import reques... | 33.241262 | 313 | 0.552408 | [
"Apache-2.0"
] | terminusdb/woql-client-p | terminusdb_client/woqlclient/woqlClient.py | 77,984 | 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... | 33.820216 | 100 | 0.605371 | [
"BSD-2-Clause",
"Apache-2.0",
"CC0-1.0",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | AjithShetty2489/spark | python/pyspark/ml/regression.py | 87,662 | Python |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 29.036585 | 79 | 0.563209 | [
"MIT"
] | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/glanceclient/tests/unit/v2/test_tags.py | 2,381 | Python |
from .impl.cloud.rest_api import RestApi
from .impl.decorators import with_project
from a2ml.api.utils.decorators import error_handler, authenticated
from .impl.model import Model
from .credentials import Credentials
class AugerModel(object):
def __init__(self, ctx):
self.ctx = ctx
self.credential... | 38.32967 | 138 | 0.711869 | [
"Apache-2.0"
] | augerai/a2ml | a2ml/api/auger/model.py | 3,488 | Python |
# Generated by Django 2.0.2 on 2018-03-25 23:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course', '0004_course_tag'),
]
operations = [
migrations.AddField(
model_name='video',
name='url',
field... | 21.315789 | 84 | 0.592593 | [
"Apache-2.0"
] | LinXueyuanStdio/TimeCat-Backend-Python | timecat/apps/course/migrations/0005_video_url.py | 413 | Python |
import itertools
import math
import string
import sys
from bisect import bisect_left as bi_l
from bisect import bisect_right as bi_r
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from operator import or_, xor
inf = float("inf")
from functools import lru_cache, reduc... | 32.195939 | 1,217 | 0.368661 | [
"MIT"
] | kagemeka/atcoder-submissions | jp.atcoder/abc009/abc009_4/17183548.py | 95,141 | Python |
import libtcodpy
libtcodpy.say_hello()
| 8.2 | 21 | 0.804878 | [
"Unlicense"
] | Rosuav/libtcodpy | tcodtest.py | 41 | Python |
# -*- coding: utf-8 -*-
"""hw06_training.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1bjAeUIVjt9W8mASk8vw1y2SbuBYuQdlG
"""
!pip install reports
import PIL.Image as Image, requests, urllib, random
import argparse, json, PIL.Image, reports, os... | 39.083485 | 168 | 0.622661 | [
"MIT"
] | arao53/BME695-object-detection | hw06_train.py | 21,535 | Python |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : spanish.py
@Time : 2020/08/21
@Author : JavierSC
@Version : 1.0
@Contact :
@Desc :
'''
class LangSpanish(object):
SETTING = "AJUSTES"
VALUE = "VALORES"
SETTING_DOWNLOAD_PATH = "Ruta de descarga"
SETTING_ONLY_M4... | 45.129032 | 108 | 0.688825 | [
"Apache-2.0"
] | joyel24/Tidal-Media-Downloader | TIDALDL-PY/tidal_dl/lang/spanish.py | 4,230 | Python |
# -*- coding: utf-8 -*-
"""
ruobr.ru/api
~~~~~~~~~~~~
Библиотека для доступа к API электронного дневника.
Пример:
>>> from ruobr_api import Ruobr
>>> r = Ruobr('username', 'password')
>>> r.getUser()
User(id=7592904, status='child', first_name='Иван', last_name='Иванов', middle_name='Иванович', school='69... | 25.566667 | 223 | 0.694915 | [
"Apache-2.0"
] | raitonoberu/ruobr_api | ruobr_api/__init__.py | 842 | Python |
#coding:utf-8
import urllib2
import sys,socket
def elasticburp(ip,port):
addr = (ip,int(port))
url = "http://" + ip + ":" + str(port) + "/_cat"
sock_9200 = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
sock_9200.settimeout(1)
sock_9200.connect(addr)
print '%s 9200 ... | 20.892857 | 86 | 0.555556 | [
"MIT"
] | webvul/Allscanner | elasticsearch/elasticsearch.py | 585 | Python |
"""grouping module"""
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import *
import itertools
import numpy as np
from numpy_indexed.index import as_index
import numpy_indexed as npi
__author__ = "Eelco Hoogendoorn"
__license__ = "LGPL"
__email__ = "hoogendoorn.eelco... | 32.655791 | 115 | 0.575082 | [
"MIT"
] | EelcoHoogendoorn/Numpy_arraysetops_EP | numpy_indexed/grouping.py | 20,018 | Python |
import argparse
import os
from multiprocessing import Process, Queue
import time
import logging
log = logging.getLogger(__name__)
from scipy import linalg
import cooler
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.cm import get_cmap
from sklearn.cluster import KMeans, Spectr... | 52.491979 | 195 | 0.596781 | [
"MIT"
] | joachimwolff/scHiCExplorer | schicexplorer/scHicCluster.py | 19,632 | Python |
from PySide import QtGui, QtCore
import os, subprocess, shutil, re
class animQt(QtGui.QMainWindow):
def __init__(self):
super(animQt, self).__init__()
self.setGeometry(250,250,360,100)
style = """
QMainWindow, QMessageBox{
background-color: qradialgradient(spread:pad, cx:0.... | 39.959538 | 202 | 0.592362 | [
"Unlicense"
] | sunil1239/FuelEfficiencyInfo | testing.py | 6,913 | Python |
from .snowflake import Snowflake
| 16.5 | 32 | 0.848485 | [
"MIT"
] | ronmorgen1/snowflake | snowflake/__init__.py | 33 | Python |
# -*- coding: utf-8 -*-
import codecs
import re
from os import path
from distutils.core import setup
from setuptools import find_packages
def read(*parts):
return codecs.open(path.join(path.dirname(__file__), *parts),
encoding='utf-8').read()
def find_version(*file_paths):
version_fil... | 31.145833 | 68 | 0.628094 | [
"BSD-3-Clause"
] | greyside/django-floppyforms | setup.py | 1,496 | Python |
from PauliInteraction import PauliInteraction
from Ising import Ising
from CoefficientGenerator import CoefficientGenerator
from Evaluator import Evaluator
#from DataVisualizer import DataVisualizer
#from DataLogger import DataLogger
import Driver as Driver_H
from MasterEquation import MasterEquation
from QuantumAn... | 26.007519 | 94 | 0.665799 | [
"MIT"
] | nicksacco17/Quantum_Information | main.py | 3,459 | Python |
from app.api.database.connect import user_information_collection
from app.api.database.execute.base_execute import BaseExecute
from app.api.helpers.convert_model2dict import user_information_helper
class ExerciseTrainerExecute(BaseExecute):
def __init__(self, data_collection, data_helper):
super().__init... | 35.307692 | 103 | 0.849673 | [
"MIT"
] | dhuynguyen94/base-code-fastapi-mongodb | {{cookiecutter.project_slug}}/app/api/database/execute/user_information.py | 459 | Python |
#
# run this command
# $ FLASK_APP=rest.py flask run
#
# request like this
# curl -X POST -H 'Accept:application/json' -H 'Content-Type:application/json' -d '{"start-time":"2019-05-08 09:15", "end-time":"2019-05-08 09:30", "match":"error", "user":"syslog", "password":"mvEPMNThq94LQuys68gR", "count":"true", "sum":"fals... | 32.257732 | 282 | 0.569191 | [
"MIT"
] | hirolovesbeer/hayabusa2 | webui/rest/rest.py | 3,129 | Python |
"""
Gadget class
"""
# Standard Library Imports
# Third Party Imports
# Local Imports
from static_analyzer.Instruction import Instruction
class Gadget(object):
"""
The Gadget class represents a single gadget.
"""
def __init__(self, raw_gadget):
"""
Gadget constructor
:param... | 46.326264 | 120 | 0.610501 | [
"MIT"
] | michaelbrownuc/GadgetSetAnalyzer | src/static_analyzer/Gadget.py | 28,398 | Python |
import hashlib
import requests
import sys
def valid_proof(last_proof, proof):
guess = f'{last_proof}{proof}'.encode()
guess_hash = hashlib.sha256(guess).hexdigest()
return guess_hash[:6] == "000000"
def proof_of_work(last_proof):
"""
Simple Proof of Work Algorithm
- Find a number p' suc... | 29.303571 | 67 | 0.61365 | [
"MIT"
] | lambda-projects-lafriedel/Blockchain | client_mining_p/miner.py | 1,641 | Python |
# Copyright 2019 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 40.60396 | 94 | 0.710802 | [
"Apache-2.0"
] | 95-martin-orion/Cirq | cirq-core/cirq/protocols/equal_up_to_global_phase_protocol.py | 4,101 | Python |
import os
import tempfile
import pytest
import mlagents.trainers.tensorflow_to_barracuda as tf2bc
from mlagents.trainers.tests.test_nn_policy import create_policy_mock
from mlagents.trainers.settings import TrainerSettings
from mlagents.tf_utils import tf
from mlagents.model_serialization import SerializationSettings,... | 37.211538 | 86 | 0.740052 | [
"Apache-2.0"
] | TPihko/ml-agents | ml-agents/mlagents/trainers/tests/test_barracuda_converter.py | 1,935 | Python |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 41.516393 | 104 | 0.699161 | [
"Apache-2.0"
] | KodeWorker/tensorflow | tensorflow/python/training/checkpoint_utils.py | 20,260 | Python |
from typing import Dict
from handler import Context, Arguments, CommandResult
from rpg.items import Item
from utils.formatting import codeblock
from utils.command_helpers import get_author_player
async def run(ctx: Context, args: Arguments) -> CommandResult:
player = await get_author_player(ctx)
if player.i... | 30.709677 | 87 | 0.652311 | [
"MIT"
] | Tarakania/discord-bot | tarakania_rpg/commands/rpg/inventory/inventory.py | 987 | Python |
from collections import namedtuple
import contextlib
import pickle
import hashlib
from llvmlite import ir
from llvmlite.llvmpy.core import Type, Constant
import llvmlite.llvmpy.core as lc
import ctypes
from numba import _helperlib
from numba.core import (
types, utils, config, lowering, cgutils, imputils, seriali... | 40.028365 | 93 | 0.614591 | [
"BSD-2-Clause"
] | DrTodd13/numba | numba/core/pythonapi.py | 66,327 | Python |
from rest_framework import serializers
from .models import Post, Comment, Friendship, Follow, Server, PostCategory, PostAuthorizedAuthor
# REST API Serializer JSON https://www.youtube.com/watch?v=V4NjlXiu5WI
from users.models import CustomUser
class UserSerializer(serializers.ModelSerializer):
class Meta:
... | 30.843137 | 97 | 0.682136 | [
"MIT"
] | cjlee1/group-project-cmput404 | backend/project404_t8/API/serializers.py | 1,573 | Python |
Version = "5.6.5"
if __name__ == "__main__":
print (Version)
| 11.166667 | 26 | 0.597015 | [
"BSD-3-Clause"
] | webpie/webpie | webpie/Version.py | 67 | Python |
import csv
from default_clf import DefaultNSL
from itertools import chain
from time import process_time
import numpy as np
import pandas as pd
NUM_PASSES = 100
NUM_ACC_PASSES = 50
TRAIN_PATH = 'data/KDDTrain+.csv'
TEST_PATH = 'data/KDDTest+.csv'
ATTACKS = {
'normal': 'normal',
'back': 'DoS',
'land': 'Do... | 30.880208 | 96 | 0.611908 | [
"MIT"
] | AnomalyIDSBenchmark/MLBenchmark | benchmark.py | 5,929 | Python |
"""
AKShare 是基于 Python 的开源财经数据接口库, 实现对股票, 期货, 期权, 基金, 债券, 外汇等金
融产品的量价数据, 基本面数据和另类数据从数据采集, 数据清洗到数据下载的工具, 满足金融数据科学
家, 数据科学爱好者在数据获取方面的需求. 它的特点是利用 AKShare 获取的是基于可信任数据源
发布的原始数据, 广大数据科学家可以利用原始数据进行再加工, 从而得出科学的结论.
"""
"""
版本更新记录:
0.1.13
更新所有基于 fushare 的接口
0.1.14
更新 requirements.txt 文件
0.1.15
自动安装所需要的 packages
0.1.16
修正部分函数命名
... | 25.871698 | 118 | 0.79617 | [
"MIT"
] | LoveRabbit007/akshare | akshare/__init__.py | 106,616 | Python |
from typing import Dict
from flask_babel import _
from anyway.backend_constants import InjurySeverity
from anyway.infographics_dictionaries import segment_dictionary
from anyway.models import InvolvedMarkerView
from anyway.request_params import RequestParams
from anyway.widgets.suburban_widgets.sub_urban_widg... | 37.870968 | 101 | 0.677172 | [
"MIT"
] | BusinessLanguage/anyway | anyway/widgets/suburban_widgets/injured_count_by_accident_year_widget.py | 2,348 | Python |
import pytest
from ml_api.api.app import create_app
from ml_api.api.config import TestingConfig
#Fixtures provide an easy way to setup and teardown resources
@pytest.fixture
def app():
app = create_app(config_object=TestingConfig)
with app.app_context():
yield app
@pytest.fixture
def flask_test_clie... | 22.111111 | 61 | 0.753769 | [
"MIT"
] | iameminmammadov/bigmart | packages/ml_api/tests/conftest.py | 398 | Python |
import scipy, copy
import SloppyCell.Utility
load = SloppyCell.Utility.load
save = SloppyCell.Utility.save
import SloppyCell.ReactionNetworks.Dynamics as Dynamics
try:
import SloppyCell.Plotting as Plotting
except ImportError:
pass
def setup(paramfile,calcobject,senstrajfile,jtjfile) :
""" Set up the quan... | 43.487267 | 111 | 0.666979 | [
"BSD-3-Clause"
] | jurquiza/SloppyCellUrquiza2019 | SloppyCell/ReactionNetworks/OptDesign.py | 25,614 | Python |
# from tensorflow.contrib.training import HParams
# from aukit.audio_io import Dict2Obj
from dotmap import DotMap
import json
class Dict2Obj(DotMap):
"""
修正DotMap的get方法生成DotMap对象的bug。
Dict2Obj的get方法和dict的get功能相同。
"""
def __getitem__(self, k):
if k not in self._map:
return None... | 53.901685 | 143 | 0.691594 | [
"MIT",
"BSD-3-Clause"
] | kozzion/breaker_audio | breaker_audio/component_cmn/synthesizer/hparams.py | 19,249 | Python |
class Doer(object):
def __init__(self, frontend):
self.__frontend = frontend
async def do(self, action):
return await self.__frontend.do(action) | 24.285714 | 47 | 0.664706 | [
"Apache-2.0"
] | maxwell-dev/maxwell-client-python | maxwell/doer.py | 170 | Python |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2018 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... | 42.087302 | 204 | 0.613426 | [
"BSD-3-Clause"
] | HelloBarry/tencent_cloud_ops | tencentcloud/ims/v20200713/ims_client.py | 5,797 | Python |
class HomonymException(Exception):
def _init_ (self, *args):
super()._init_(args)
class Homonym():
def __init__(self):
pass
def CreateModel(self):
pass
def SgdScore(self, rounds):
pass
def FindErrors(self):
pass
| 14.631579 | 34 | 0.579137 | [
"MIT"
] | Biatris/Homonym | homonym.py | 278 | Python |
# First create a Shuffle list
my_shuffle_list = [1,2,3,4,5]
# Now Import shuffle
from random import shuffle
shuffle(my_shuffle_list)
print(my_shuffle_list) # check wether shuffle is working or not
# Now let's create Guess Game. First create a list
mylist = ['','o','']
# Define function which will used furth... | 27.075 | 84 | 0.6759 | [
"MIT"
] | alok-techqware/basic_python_practicse | python_basics/Method_ function/mixed_function_guess_game.py | 1,083 | Python |
# qubit number=5
# total number=45
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... | 30.878788 | 82 | 0.603042 | [
"BSD-3-Clause"
] | UCLA-SEAL/QDiff | benchmark/startQiskit953.py | 4,076 | Python |
import numpy as np
import pandas as pd
X = np.load('preds.npy')
img = pd.read_csv('test.csv')
img['x1'] = X[:,0]*640
img['x2'] = X[:,1]*640
img['y1'] = X[:,2]*480
img['y2'] = X[:,3]*480
""" img['x1'] = 0.05*640
img['x2'] = 0.95*640
img['y1'] = 0.05*480
img['y2'] = 0.95*480 """
img.to_csv('subbigles.csv',index = False) | 24.538462 | 41 | 0.567398 | [
"MIT"
] | mukul54/Flipkart-Grid-Challenge | codes/write_csv.py | 319 | Python |
from sources import Sources
from stories import Stories
class Bot():
def __init__(self, config):
self.url = config.get_url()
self.sources = None
self.stories = None
def load(self):
self.sources = Sources(self.url)
self.stories = Stories(self.sources)
... | 34.403226 | 95 | 0.547586 | [
"MIT"
] | sagol/umorilibot | bot.py | 2,195 | Python |
from django.shortcuts import render
from accounts import models
from rest_framework import viewsets
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_set... | 54.25 | 153 | 0.777266 | [
"MIT"
] | eliefrancois/project2-diabetesapplication-api | backend/accounts/views.py | 1,953 | Python |
def now():
print('2017-05-31')
now.__name__
f = now
f.__name__
# 定义记录log的装饰器
def log(func):
def wrapper(*args, **kw):
print('call %s():' % func.__name__)
return func(*args, **kw)
return wrapper
@log
def now1():
print('2017-05-31')
# 如果 decorator 需要传入参数,需要编写一个返回 decorator 的高阶函数
d... | 17.618182 | 53 | 0.562436 | [
"Apache-2.0"
] | zhayangtao/HelloPython | python01/PythonDecorator.py | 1,035 | Python |
"""
mbase module
This module contains the base model class from which
all of the other models inherit from.
"""
import abc
import os
import shutil
import threading
import warnings
import queue as Queue
from datetime import datetime
from shutil import which
from subprocess import Popen, PIPE, STDOUT
import copy
im... | 31.202778 | 89 | 0.531968 | [
"CC0-1.0",
"BSD-3-Clause"
] | andrewcalderwood/flopy | flopy/mbase.py | 56,165 | Python |
df['A']
# A
# ---------
# -0.613035
# -1.265520
# 0.763851
# -1.248425
# 2.105805
# 1.763502
# -0.781973
# 1.400853
# -0.746025
# -1.120648
#
# [100 rows x 1 column] | 11.1875 | 23 | 0.497207 | [
"Apache-2.0"
] | 13927729580/h2o-3 | h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_select_column_name.py | 179 | Python |
# -*- coding: utf-8 -*-
"""Docstring Parsers/Formatters"""
# TODO: break this module up into smaller pieces
import sys
import re
from textwrap import dedent
from collections import OrderedDict
from itertools import islice
from .autodocstring_logging import logger
PY3k = sys.version_info[0] == 3
if PY3k:
string... | 35.641717 | 89 | 0.540895 | [
"MIT"
] | KristoforMaynard/SublimeAutoDocstring | docstring_styles.py | 35,713 | Python |
from importlib.machinery import SourceFileLoader
import io
import os.path
from setuptools import find_packages, setup
sourcedml = SourceFileLoader("sourced-ml-core", "./sourced/ml/core/__init__.py").load_module()
with io.open(os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8") as f:
long_desc... | 35.410959 | 94 | 0.629014 | [
"Apache-2.0"
] | zurk/ml-core | setup.py | 2,585 | Python |
#
from binho.errors import DriverCapabilityError
class binhoAccessory:
""" Base class for objects representing accessory boards. """
# Optional: subclasses can set this variable to override their accessory name.
# If not provided, their name will automatically be taken from their class names.
# This ... | 34.565217 | 89 | 0.657233 | [
"BSD-3-Clause"
] | binhollc/binho-python-package | binho/accessory.py | 1,590 | Python |
# coding: utf-8
"""
flyteidl/service/admin.proto
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: version not set
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import... | 25.463415 | 119 | 0.737548 | [
"Apache-2.0"
] | EngHabu/flyteidl | gen/pb_python/flyteidl/service/flyteadmin/test/test_admin_pager_duty_notification.py | 1,044 | Python |
__author__ = 'Burgos, Agustin - Schelotto, Jorge'
# -*- coding: utf-8 -*-
# Copyright 2018 autors: Burgos Agustin, Schelotto Jorge
#
# 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 res... | 35.978495 | 128 | 0.633293 | [
"MIT"
] | JorgeSchelotto/TrabajoFinalSeminarioPython | Clases/Palabras.py | 3,347 | Python |
"""
Configuration file for py.test
"""
import django
def pytest_configure():
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
USE_I18N=True,
ROOT_URLCONF="tests.urls",
DATABASES={
"default": {
"ENGINE": "django.d... | 27.111111 | 77 | 0.536066 | [
"BSD-2-Clause"
] | bennylope/django-simple-auth | conftest.py | 1,220 | Python |
import sys
from subprocess import Popen
import cx_Oracle
root_directory = sys.argv[1]
def main(directory):
public_projects = get_public_project_accessions()
for project_accession in public_projects:
Popen(['./runAnnotator.sh', directory, str(project_accession)])
# get all the project references fr... | 28.261905 | 173 | 0.730413 | [
"Apache-2.0"
] | PRIDE-Cluster/cluster-result-importer | scripts/batchAnnotator.py | 1,187 | Python |
# Timing functionality from Python's built-in module
from time import perf_counter
from functools import lru_cache
def timer(fn):
def inner(*args):
start = perf_counter()
result = fn(*args)
end = perf_counter()
elapsed = end - start
print(result)
print('elapsed', el... | 17.853659 | 66 | 0.592896 | [
"MIT"
] | zubrik13/udacity_inter_py | lesson3-functional_programming/timing.py | 732 | Python |
from echo import CallbackProperty, SelectionCallbackProperty, keep_in_sync, delay_callback
from matplotlib.colors import to_rgba
from glue.core.message import LayerArtistUpdatedMessage
from glue.core.state_objects import State
from glue.viewers.common.state import ViewerState, LayerState
from glue.utils import defe... | 38.404762 | 107 | 0.666726 | [
"BSD-3-Clause"
] | cnheider/glue | glue/viewers/matplotlib/state.py | 11,291 | Python |
#!/usr/bin/env python3
import os
import platform
import shutil
import sys
from urllib import request
import bs4
import patoolib
url = "http://bearware.dk/teamtalksdk"
cd = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def get_url_suffix_from_platform() -> str:
machine = platform.machine()
i... | 28.933333 | 86 | 0.569636 | [
"MIT"
] | ahmetecevitli/TTMediaBot | tools/ttsdk_downloader.py | 3,906 | Python |
from . import (
yaw,
layout,
base_COE,
optimization,
layout_height,
power_density,
yaw_wind_rose,
power_density_1D,
yaw_wind_rose_parallel,
)
| 14.833333 | 27 | 0.651685 | [
"Apache-2.0"
] | ArnaudRobert/floris | floris/tools/optimization/scipy/__init__.py | 178 | Python |
# Copyright (C) 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 25.597633 | 74 | 0.561258 | [
"Apache-2.0"
] | google/cyanobyte | test/sampleData/micropython/MCP4725.py | 4,326 | Python |
from drawy import *
class Button:
def __init__(self, text, click_handler, point, width, height, *, hide=False, do_highlight=True, background_color='gray', highlight_color='lightgray', text_color='black', border_color='black'):
self.text = text
self.click_handler = click_handler
self.p... | 34.038462 | 197 | 0.640678 | [
"MIT"
] | NextLight/drawy | examples/button.py | 1,770 | Python |
# Charlie Conneely
# Score Keeper
from player import Player
ranks_file = "rankings.txt"
class ScoreKeeper:
def __init__(self):
self.ranks = []
"""
Check if player score ranks against scores in rankings.txt
"""
def check_ranking(self, p):
self.populate_ranks_array(ranks_file)
... | 28.428571 | 80 | 0.548241 | [
"MIT"
] | charlieconneely/countdown | score_system.py | 1,990 | Python |
import numpy as np
import pandas as pd
import scipy.stats
from .utils_complexity_embedding import complexity_embedding
from .entropy_shannon import entropy_shannon
def entropy_distribution(signal=None, delay=1, dimension=3, bins="Sturges", base=2):
"""**Distribution Entropy (DistrEn)**
Distribution Entropy ... | 32.905172 | 98 | 0.596804 | [
"MIT"
] | danibene/NeuroKit | neurokit2/complexity/entropy_distribution.py | 3,817 | Python |
import numpy as np
import pandas as pd
import matlibplot.pyplot as plt
'''
Simulating Solow-Swan model, which attempts to model the long-run economic growth
by looking at capital accumulation (K), population growth (L) and technological
progress, which results in increase in productivity. It models the total product... | 30.453782 | 111 | 0.560706 | [
"Apache-2.0"
] | zhaoy17/Macro_lib | macro_lib/growth/solow.py | 7,248 | Python |
#!/usr/local/bin/python
# based on code by henryk ploetz
# https://hackaday.io/project/5301-reverse-engineering-a-low-cost-usb-co-monitor/log/17909-all-your-base-are-belong-to-us
# and the wooga office weather project
# https://blog.wooga.com/woogas-office-weather-wow-67e24a5338
import os, sys, fcntl, time, socket
fr... | 30.452991 | 121 | 0.575639 | [
"MIT"
] | mvelten/office-weather | monitor.py | 3,563 | Python |
# -*- coding: utf-8 -*-
import os.path as osp
#import netCDF4
#from netcdf_helpers.reader import say_hello, get_time_series_from_location
#from plot.plot import plot_time_series_for_locations
#from sklearn.model_selection import train_test_split
#from sklearn.preprocessing import MinMaxScaler
import numpy as np
... | 46.734513 | 167 | 0.709903 | [
"MIT"
] | NatalieBarbosa/hida-datathon-ufz | SK_Clustering_WIP.py | 5,281 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.