max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tasks/islands.py | rampasek/HGNet | 10 | 49100 | <reponame>rampasek/HGNet<filename>tasks/islands.py
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
class UnionFind:
def __init__(self, n):
self.A = [-1] * n
def find(self, x):
if self.A[x] < 0:
return x
else:
self.A[x] = self.find(self.... | 3.078125 | 3 |
macdaily/core/brew.py | JarryShaw/MacDaily | 10 | 49101 | <reponame>JarryShaw/MacDaily<gh_stars>1-10
# -*- coding: utf-8 -*-
import abc
import contextlib
import glob
import os
import re
import shutil
import sys
import traceback
from macdaily.cls.command import Command
from macdaily.util.compat import pathlib, subprocess
from macdaily.util.const.term import (bold, flash, gre... | 2.140625 | 2 |
wagtail_blog/admin.py | pizzapanther/wagtail-blog-app | 0 | 49102 | from wagtail.admin.edit_handlers import FieldPanel
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail_blog.models import BlogPage, BlogIndexPage
# Add your Wagtail panels here.
BlogIndexPage.content_panels = [
FieldPanel('title', classname="full title"),
FieldPanel('headline'),
]
BlogPa... | 1.65625 | 2 |
test/kb_Amplicon_server_2_test.py | Tianhao-Gu/kb_Amplicon | 0 | 49103 | # -*- coding: utf-8 -*-
import os
import time
import unittest
import inspect
from mock import patch
import requests
from configparser import ConfigParser
from kb_Amplicon.kb_AmpliconImpl import kb_Amplicon
from kb_Amplicon.kb_AmpliconServer import MethodContext
from installed_clients.authclient import KBaseAuth as _KB... | 1.828125 | 2 |
maxcube/thermostat.py | copyrights/python-maxcube-api | 2 | 49104 | from maxcube.wallthermostat import MaxWallThermostat
class MaxThermostat(MaxWallThermostat):
def __init__(self):
super(MaxThermostat, self).__init__()
self.temperature_offset = None
self.window_open_temperature = None
self.window_open_duration = None
self.boost_duration = N... | 2.40625 | 2 |
aio_graphite_api/carbon/pool.py | yunstanford/aio-graphite-api | 1 | 49105 | <filename>aio_graphite_api/carbon/pool.py<gh_stars>1-10
import asyncio
import random
from aio_graphite_web.hashing.keyfunc import key_func
from aio_graphite_web.hashing.hashingring import ConsistentHashRing
from .connection import CarbonConn
async def init_conn_pool(config):
"""
a helper function to init conn... | 2.515625 | 3 |
explore/helper_functions.py | polosecki/ton_rfmri_repo | 1 | 49106 | # -*- coding: utf-8 -*-
"""
Helper functions to organize CHDI imaging data
Created on Fri Jan 15 11:07:53 2016
@author: <NAME>
Python Version: Python 3.5.1 |Anaconda 2.4.1 (64-bit)
"""
import glob as gl
import pandas as pd
import numpy as np
import os
from functools import partial
def linear_pred(m,b,x):
y = m ... | 2.625 | 3 |
DLA Lorenzo/Walker.py | Naroloal/dlaCluster | 0 | 49107 | <filename>DLA Lorenzo/Walker.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 30 10:57:10 2018
@author: lorenzo
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
import imageio
import os
import time
import pickle
import copy as cp
start = time.time()
Radio = 8... | 2.90625 | 3 |
Python/Ex013.py | renato-rt/Python | 0 | 49108 | s = float(input('\033[1;24;3mQual é o salário do funcionário? \033[m'))
print('Um funcionário que ganhava R${:.2f} com 15% de aumento agora ganhará R${:.2f}.'.format(s, s+(s*15/100))) | 3.546875 | 4 |
t128_aap_logscanner.py | rshtirmer/aap_log_scanner | 1 | 49109 | import sys
import os
import requests
from datetime import datetime, timedelta
import argparse
import json
def parseArgs():
parser = argparse.ArgumentParser()
parser.add_argument('--startdate', nargs='?', default=getTodayStr(), type=str, help="Provide a start date, for example: 2019-06-13. \nDefaults to today's... | 3 | 3 |
ondewo/t2s/client/services/text_to_speech.py | ondewo/ondewo-t2s-client-python | 0 | 49110 | <reponame>ondewo/ondewo-t2s-client-python
from google.protobuf.empty_pb2 import Empty
from ondewo.utils.base_services_interface import BaseServicesInterface
from ondewo.t2s.text_to_speech_pb2 import (
ListT2sPipelinesRequest,
ListT2sPipelinesResponse,
SynthesizeRequest,
SynthesizeResponse,
T2sPipel... | 2.4375 | 2 |
BMI.py | wangwanglulu/python2 | 1 | 49111 | <reponame>wangwanglulu/python2
print("BMI指数计算器\n")
inp_1 = input('请输入您的体重(kg):\n')
inp_2 = input('请输入您的身高(cm):\n')
try:
weight = float(inp_1)
except:
print('Please enter a number')
try:
height = float(inp_2)
except:
print('Please enter a number')
BMI = weight/(height/100)**2
if BMI<18.5:
print("您的体型偏瘦"... | 3.90625 | 4 |
SMFSWcolor/colCIELab.py | SMFSW/SMFSWcolor | 0 | 49112 | <reponame>SMFSW/SMFSWcolor
# -*- coding: utf-8 -*-
""" colCIEObsLab.py
Author: SMFSW
Copyright (c) 2016-2021 SMFSW
Description: CIE-L*ab color space class
"""
from math import *
from colorConv import *
from colBase import ColBase as cB
from colorFuncs import ColorChecker
import colCIELCHab as cCIELCHab
import colXYZ ... | 2.703125 | 3 |
setup.py | piotrantosz/siege-engine | 0 | 49113 | <filename>setup.py
from setuptools import setup
setup(version='1.5')
| 0.925781 | 1 |
draw fractal/Fern/Fern__PIL.py | DazEB2/SimplePyScripts | 117 | 49114 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Папоротник / Fern
"""
# Оригинал: http://www.cyberforum.ru/pascalabc/thread994987.html
# uses GraphABC,Utils;
#
# const
# n=255;
# max=10;
#
# var
# x,y,x1,y1,cx,cy: real;
# i,ix,iy: integer;
# // z... | 3.046875 | 3 |
PyPowerFlex/objects/system.py | dell/python-powerflex | 5 | 49115 | # Copyright (c) 2020 Dell Inc. or its subsidiaries.
# 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... | 1.9375 | 2 |
cube.py | allala0/rubiks-cube.py | 1 | 49116 | <gh_stars>1-10
import copy
import random
from termcolor import colored
from colorama import init
# colorama init
init()
class Cube:
def __init__(self, size=3):
self.size = size
self.cube = self.generate(size)
@staticmethod
def generate(size: int) -> list:
"""
Generates c... | 3.390625 | 3 |
adrian/cgen/includes.py | adrian-lang/paka.cgen | 1 | 49117 | from adrian.cgen import Include
stdlib = Include("stdlib.h")
stdint = Include("stdint.h")
stdio = Include("stdio.h")
assert_ = Include("assert.h")
| 1.195313 | 1 |
gg/game.py | willieLjohnson/pygg | 0 | 49118 | from dataclasses import dataclass
import pygame
import pymunk
import pymunk.pygame_util
from . import style
from . import display
from . import structures
@dataclass(unsafe_hash=True)
class Game:
__metaclass__ = structures.IterableObject
name = ""
entities = {}
style = style.GGSTYLE()
space:... | 2.671875 | 3 |
notebooks/src/code/__init__.py | verdimrc/amazon-textract-transformer-pipeline | 22 | 49119 | <reponame>verdimrc/amazon-textract-transformer-pipeline<gh_stars>10-100
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""Amazon Textract + LayoutLM model training and inference code package for SageMaker
Why the extra level of nesting? Because the src folder (eve... | 1.484375 | 1 |
porcupine/dirs.py | rscales02/porcupine | 0 | 49120 | # TODO: move this to __init__.py? this was in a separate file because
# setup.py used to import porcupine but it doesn't do it anymore
import os
import platform
import appdirs
from porcupine import __author__ as _author
if platform.system() in {'Windows', 'Darwin'}:
# these platforms like path names like "Prog... | 2.203125 | 2 |
parser.py | Darksidis/justiva-script | 0 | 49121 | <reponame>Darksidis/justiva-script
import re
import requests
from bs4 import BeautifulSoup
import urllib3
import schedule
import time
import regexp as r
from const import login, password
urllib3.disable_warnings()
s = requests.Session()
LOGIN_URL = 'https://justiva.ru/login'
headers = {
'accept': 'text/html,app... | 2.1875 | 2 |
vnpy/app/cta_strategy/strategies/tsmyo_orb_strategy.py | TheSuperMyo/vnpy | 0 | 49122 | from datetime import time
from vnpy.app.cta_strategy import (
CtaTemplate,
StopOrder,
TickData,
BarData,
TradeData,
OrderData,
BarGenerator,
ArrayManager
)
from vnpy.app.cta_strategy.base import (
EngineType,
STOPORDER_PREFIX,
StopOrder,
StopOrderStatus,
)
from vnpy.app.c... | 2 | 2 |
powderday/sph_tributary.py | mccbc/powderday | 0 | 49123 | from __future__ import print_function
import numpy as np
import yt
from hyperion.model import Model
import matplotlib as mpl
mpl.use('Agg')
import powderday.config as cfg
from powderday.grid_construction import yt_octree_generate
from powderday.find_order import find_order
import powderday.powderday_test_octree as pt... | 2.015625 | 2 |
api/v1/utilities/su.py | UCCNetsoc/cloud | 9 | 49124 | <filename>api/v1/utilities/su.py
import os
class Guard:
_preserved_uid: int
_preserved_gid: int
_uid: int
_gid: int
def __init__(self, uid: int, gid: int):
# safety measure
if uid == 0 or gid == 0:
print("Tried to su Guard to root :(")
os.exit(-1)
... | 2.4375 | 2 |
backup-23.09.2021/core/data_compression.py | ComputerSystemsLaboratory/Code-Size-Prediction | 0 | 49125 | <filename>backup-23.09.2021/core/data_compression.py
import yaml
import pickle
import argparse
import pandas as pd
import numpy as np
from os import listdir
from os.path import isfile, join
class LoadData:
def __init__(self, name, embedding, fitness_path, keys, objects):
self.name = name
self.emb... | 2.578125 | 3 |
utils/sen2cor_prepare.py | Zac-HD/datacube-core | 2 | 49126 | <reponame>Zac-HD/datacube-core
# coding=utf-8
"""
Ingest data from the command-line.
"""
from __future__ import absolute_import
import uuid
import logging
from xml.etree import ElementTree
from pathlib import Path
import yaml
import click
from osgeo import osr
import os
# image boundary imports
from rasterio import c... | 2.046875 | 2 |
Python3_Mundo1_Aula7/Desafio009.py | AgladeJesus/python | 0 | 49127 | <gh_stars>0
a = int(input('Construa a tabuada do Número: '))
aux = 0
print('*' * 18)
print('Trabuada de {}'.format(a))
print('*' * 18)
while (aux <= 10):
print('{} X {:2} = {:4}'.format(a, aux, (a * aux)))
aux = aux + 1
| 3.625 | 4 |
ceilometerclient/tests/unit/test_shell.py | mail2nsrajesh/python-ceilometerclient | 0 | 49128 | # 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
# distribu... | 1.695313 | 2 |
coder_news/dataUpdate/Java/ibm.py | shixuan163556/CoderNewsDjango | 2 | 49129 | <gh_stars>1-10
from bs4 import BeautifulSoup
from coder_news.dataUpdate.dataModel import dataModel
import requests
def get_ibm():
url = "https://developer.ibm.com/technologies/java/"
res = requests.get(url)
soup = BeautifulSoup(res.text, "html.parser")
home = soup.find("a", class_="ibm--hub__block_link... | 2.921875 | 3 |
second/run_bev_det.py | hankeceli/3D-Object-Detection-for-AV | 0 | 49130 | #!/usr/bin/env python
# coding: utf-8
import argparse
import os
import sys
from pathlib import Path
import matplotlib.pyplot as plt
import pytorch_lightning as pl
from src.config.config import SEED
from src.dataset.seg_datamodule import Lyft3DdetSegDatamodule
from src.modeling.seg_pl_model import LitModel
from src.ut... | 2.09375 | 2 |
custom_components/hue_sync_box/const.py | nitobuendia/hue-sync-box-custom-component | 8 | 49131 | <reponame>nitobuendia/hue-sync-box-custom-component<filename>custom_components/hue_sync_box/const.py
"""Constants and common variables for Philips Hue Sync Box."""
from homeassistant import const
# Set up.
DOMAIN = 'hue_sync_box'
PLATFORMS = ['remote']
TOKEN_FILE = 'hue-sync-box-token-cache-{}'
# Platform config.
CO... | 1.789063 | 2 |
maskpw.py | harmony5/maskpw | 0 | 49132 | """A simple library to ask the user for a password. Similar to getpass.getpass() but allows to specify a default mask (like '*' instead of blank)."""
__version__ = "0.5.5"
from sys import platform, stdin
if platform == "win32":
from msvcrt import getch as __getch
def getch():
return __getch().decode... | 3.84375 | 4 |
evaluation/__init__.py | Leinadh/PeruvianImageGenerator | 3 | 49133 | <reponame>Leinadh/PeruvianImageGenerator
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from .utils_tsne import apply_tsne, generate_scatter
def tsne_evaluation(ls_feature_arrays, ls_array_names, pca_components=None, perplexity=30, n_iter=1000, save_image=False, output_dir='./... | 2.4375 | 2 |
smartlingApiSdk/api/EstimatesApi.py | Smartling/api-sdk-python | 8 | 49134 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Copyright 2012-2021 Smartling, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this work except in compliance with the License.
* You may obtain a copy of the License in the LICENSE file, or at:
*
* http://www.apache.org/l... | 1.9375 | 2 |
Cracking the Coding Interview/ctci-solutions-master/ch-08-recursion-and-dynamic-programming/09-parens.py | nikku1234/Code-Practise | 9 | 49135 | # List all valid strings containing n opening and n closing parenthesis.
# Note that parens1 happens to be faster and more space efficient than parens2,
# which is faster than parens3. The slowest is parens4 only because it is not
# memoized.
def parens1(n):
parens_of_length = [[""]]
if n == 0:
return parens... | 3.453125 | 3 |
aiida_ase3/calculations.py | sudarshanv01/aiida-ase-test | 0 | 49136 | # -*- coding: utf-8 -*-
"""
Calculations provided by aiida_ase3.
Register calculations via the "aiida.calculations" entry point in setup.json.
"""
from aiida.common import datastructures
from aiida.engine import CalcJob
from aiida.orm import SinglefileData, Str
from aiida.plugins import DataFactory
DiffParameters = D... | 2.28125 | 2 |
pygomas/bdisoldier.py | sfp932705/pygomas | 3 | 49137 | <filename>pygomas/bdisoldier.py
from collections import deque
from .vector import Vector3D
from .bditroop import BDITroop, CLASS_SOLDIER
from .config import BACKUP_SERVICE, DESTINATION, VELOCITY, HEADING
from agentspeak import Actions
from agentspeak import grounded
from agentspeak.stdlib import actions as asp_action... | 2.28125 | 2 |
ghostwriter/reporting/tests/factories.py | fastlorenzo/Ghostwriter | 0 | 49138 | <reponame>fastlorenzo/Ghostwriter<filename>ghostwriter/reporting/tests/factories.py
# 3rd Party Libraries
import factory
class FindingFactory(factory.django.DjangoModelFactory):
class Meta:
model = "reporting.Finding"
django_get_or_create = ("title",)
| 1.6875 | 2 |
api/serializers.py | choi-jiwoo/capstone-project-django | 0 | 49139 | <filename>api/serializers.py
from rest_framework.serializers import ModelSerializer
from api.models import Stay, Cafe, Res, CafeTag, ResTag, CafeKwrd, ResKwrd
class StaySerializer(ModelSerializer):
class Meta:
model = Stay
fields = '__all__'
class CafeSerializer(ModelSerializer):
class Meta:... | 2.234375 | 2 |
scrapers/scrape_sg.py | andreasamsler/covid_19 | 0 | 49140 | <filename>scrapers/scrape_sg.py
#!/usr/bin/env python3
import re
import datetime
import sys
from bs4 import BeautifulSoup
import scrape_common as sc
url = 'https://www.sg.ch/tools/informationen-coronavirus.html'
d = sc.download(url, silent=True)
d = d.replace(' ', ' ')
soup = BeautifulSoup(d, 'html.parser')
# ... | 3.0625 | 3 |
main.py | clitic/up-to-pypi | 0 | 49141 | import up_to_pypi.main
up_to_pypi.main.main()
| 1.054688 | 1 |
saleor/core/migrations/0005_alter_eventdelivery_webhook.py | eanknd/saleor | 1,392 | 49142 | # Generated by Django 3.2.12 on 2022-04-08 12:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("webhook", "0008_webhook_subscription_query"),
("core", "0004_delete_delivery_without_webhook"),
]
operatio... | 1.3125 | 1 |
src/visualization/config.py | charity-sotero/apartment_atmosphere | 0 | 49143 | <reponame>charity-sotero/apartment_atmosphere<gh_stars>0
GOOGLE_PLACES_API_KEY = '<KEY>' | 0.925781 | 1 |
ExpenseProject/ExpenseApp/migrations/0016_remove_expensemodel_expenses.py | cs-fullstack-fall-2018/project3-django-psanon19 | 0 | 49144 | <filename>ExpenseProject/ExpenseApp/migrations/0016_remove_expensemodel_expenses.py<gh_stars>0
# Generated by Django 2.0.6 on 2018-10-27 04:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ExpenseApp', '0015_auto_20181026_1800'),
]
operations = [
... | 1.15625 | 1 |
Python 基础教程/1.5.7 lamda应用.py | shao1chuan/pythonbook | 95 | 49145 | <gh_stars>10-100
# https://blog.csdn.net/zjuxsl/article/details/77104382
# 一、lambda函数也叫匿名函数,即,函数没有具体的名称。先来看一个最简单例子:
def f(x):
return x**2
print(f(4))
# Python中使用lambda的话,写成这样
g = lambda x : x**2
print (g(4))
# lambda语句中,冒号前是参数,可以有多个,用逗号隔开,冒号右边的返回值。
# lambda语句构建的其实是一个函数对象
from functools import reduce
reduce(lambda x... | 3.34375 | 3 |
fb_messenger/webhooks.py | shananin/fb_messanger | 2 | 49146 | <gh_stars>1-10
"""
Callbacks parser
"""
from __future__ import unicode_literals
from . import webhook_attachments
from .types import webhook_types
def parse_payload(payload):
# pylint: disable=too-many-return-statements
if 'message' in payload:
return MessageReceived(payload)
elif 'delivery' in p... | 2.34375 | 2 |
turbustat/statistics/convolve_wrapper.py | CFD-UTSA/Turbulence-stars | 42 | 49147 | <reponame>CFD-UTSA/Turbulence-stars
# Licensed under an MIT open source license - see LICENSE
from __future__ import (print_function, absolute_import, division,
unicode_literals)
try:
from pyfftw.interfaces.numpy_fft import fftn, ifftn
PYFFTW_FLAG = True
except ImportError:
PYFFTW_F... | 1.828125 | 2 |
app.py | Akali27/15-Interactive-Visualizations-and-Dashboards | 0 | 49148 | import json
from flask import Flask
from flask import render_template
import csv
import os
import pandas as pd
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
APP_STATIC = os.path.join(APP_ROOT, 'static')
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html', name='abc')
... | 3.03125 | 3 |
HRRR/neural_network_interp.py | ahijevyc/NSC_objects | 0 | 49149 | <filename>HRRR/neural_network_interp.py
#!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm, ListedColormap,BoundaryNorm
import numpy as np
import datetime as dt
import sys, os, pickle, time
from scipy.ndimage.filters import gaussian_filte... | 2.140625 | 2 |
22爬虫提高/day04/basic01.py | HaoZhang95/PythonAndMachineLearning | 937 | 49150 | <gh_stars>100-1000
import json
import time
import requests
from PIL import Image
from pytesseract import pytesseract
from selenium import webdriver
"""
selenium和xpath的使用区别
selenium使用不需要自己写headers,只需要导入webdriver.Chrome().get(url)就会打开浏览器,使用find_xxx_by_xpath
写入自己的xpath语句即可
传统的xpath使用,需要导入etree.Html(... | 3 | 3 |
b3/guess_type.py | oddy/b3 | 5 | 49151 | <reponame>oddy/b3
# Python-Obj to B3-Type guesser for composite_dynamic (pack)
import datetime, decimal
from six import PY2
from b3.datatypes import *
def guess_type(obj):
if isinstance(obj, bytes): # Note this will catch also *str* on python2. If you want unicode out, pass unicode in.
... | 2.421875 | 2 |
office365/directory/applications/spa_application.py | rikeshtailor/Office365-REST-Python-Client | 544 | 49152 | from office365.runtime.client_value import ClientValue
class SpaApplication(ClientValue):
pass
| 1.226563 | 1 |
problem/01000~09999/02862/2862.py3.py | njw1204/BOJ-AC | 1 | 49153 | def ans(n):
global fib
for i in range(1,99):
if fib[i]==n: return n
if fib[i+1]>n: return ans(n-fib[i])
fib=[1]*100
for i in range(2,100):
fib[i]=fib[i-1]+fib[i-2]
n=int(input())
print(ans(n)) | 2.890625 | 3 |
porcupine/plugins/run/__init__.py | ThePhilgrim/porcupine | 0 | 49154 | """Compile, run and lint files."""
import dataclasses
import logging
import os
import pathlib
import shlex
import sys
from functools import partial
from typing import List, Optional
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from porcupine import get... | 2.421875 | 2 |
price_picker/models/shop.py | M0r13n/price_picker | 3 | 49155 | from price_picker.common.database import CRUDMixin
from price_picker import db
class Shop(CRUDMixin, db.Model):
""" Shops """
__tablename__ = 'shops'
name = db.Column(db.String(128), primary_key=True, unique=True, default="Zentrale")
@classmethod
def query_factory_all(cls):
# insert defau... | 2.578125 | 3 |
scripts/colorize/las_colorize.py | SPINLab/rijkswaterstaat-data-tools | 1 | 49156 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Python3
@author: <NAME>
"""
import sys
import os
import argparse
import subprocess
import json
import math
def run_pdal(path, input_path, output_path, las_srs, wms_url,
wms_layer, wms_srs, wms_version, wms_format, wms_ppm,
wms_max_image_size):
... | 2.25 | 2 |
lib/paramsweep_w2_deltaT_counterfactual.py | benlansdell/deep-rdd | 4 | 49157 | import numpy as np
from lib.lif import LIF, ParamsLIF
from lib.causal import causaleffect
#Set x = 0, sigma = 10
#wvals = 2..20
sigma = 10
mu = 1
tau = 1
t = 500
params = ParamsLIF(sigma = sigma, mu = mu, tau = tau)
lif = LIF(params, t = t)
lif.x = 0
#Simulate for a range of $W$ values.
N = 19
nsims = 1
wmax = 20
n =... | 1.96875 | 2 |
bridgeClient.py | omega3love/BridgeProject | 0 | 49158 | <filename>bridgeClient.py<gh_stars>0
#! /usr/bin/python
import socket
import threading
from time import sleep
import sys, os
import inputbox
import pygame
from bridgeSprites import Button
class userInterfaceWindow():
def __init__(self, screen):
self.screen = screen
self.clients = []
self.userName = inpu... | 2.875 | 3 |
class3/exercise2.py | befthimi/be_pynet_course | 0 | 49159 | #!/usr/bin/env python
"""
Script that graphs interface stats
"""
import time
import snmp_helper
import pygal
intfInOctets_fa4 = '1.3.6.1.2.1.2.2.1.10.5'
intfInUcastPkts_fa4 = '1.3.6.1.2.1.2.2.1.11.5'
intfOutOctets_fa4 = '1.3.6.1.2.1.2.2.1.16.5'
intfOutUcastPkts_fa4 = '1.3.6.1.2.1.2.2.1.17.5'
router1 = ('172.16.31.10',... | 2.578125 | 3 |
obliv/__init__.py | dsroche/obliv | 2 | 49160 | <gh_stars>1-10
__all__ = ["hirb", "voram", "skipstash", "fstore", "mt_ssh_store", "ssh_info", "idstr"]
| 1.148438 | 1 |
Python/OsFileSystem/list_files.py | Gjacquenot/training-material | 115 | 49161 | #!/usr/bin/env python
from argparse import ArgumentParser
import os
import sys
if __name__ == '__main__':
arg_parser = ArgumentParser(description='list all files with given '
'extension in directory')
arg_parser.add_argument('--dir', default='.',
... | 3.125 | 3 |
tests/test_graph.py | ssube/redesigned-barnacle | 0 | 49162 | from redesigned_barnacle.buffer import CircularBuffer
from redesigned_barnacle.graph import Sparkline
from redesigned_barnacle.mock import MockFramebuffer
from unittest import TestCase
class SparkTest(TestCase):
def test_line(self):
buf = CircularBuffer()
sl = Sparkline(32, 64, buf)
sl.push(16)
sl.d... | 1.945313 | 2 |
testapp/wagtail_wordpress_processor/management/commands/base_command.py | nickmoreton/wagtail_wordpress_importer | 0 | 49163 | <reponame>nickmoreton/wagtail_wordpress_importer
from django.core.management import BaseCommand
from wagtail_wordpress_importer.utils import spinner
class BaseProcessCommand(BaseCommand):
def output_start(self, message, newline=''):
self.stdout.write(message, ending=newline)
def output_message_succe... | 2.078125 | 2 |
Labs/LineSweep/plots.py | jessicaleete/numerical_computing | 10 | 49164 | <gh_stars>1-10
# This plotting file is rather old code.
# It generates a full set of plots illustrating the two different linesweep
# algorithms on randomly chosen points.
# It should be updated at some point so that the random number generator
# is seeded with some specifically chosen seed that generates plots that
# ... | 3.046875 | 3 |
setup.py | rsp9u/stingconf | 0 | 49165 | import os
import sys
import codecs
from setuptools import setup
tests_require = [
'pytest',
'pytest-mock',
]
if sys.version_info < (3, 0):
tests_require.append('mock')
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
return codecs.open(file_path, encoding='utf-8').rea... | 1.625 | 2 |
setup.py | eshandas/simple_django_logger | 0 | 49166 | from setuptools import find_packages, setup
# Read more here: https://pypi.org/project/twine/
setup(
name='simple_django_logger',
# packages=[
# 'simple_django_logger', # this must be the same as the name above
# 'simple_django_logger.middleware',
# 'simple_django_logger.migrations'],
... | 1.539063 | 2 |
sporting_webapp/nfl_package/urls.py | plopez9/chipy_sports_app_2.0 | 0 | 49167 | <gh_stars>0
from django.urls import path, include
from . import views
from rest_framework import routers
router = routers.DefaultRouter()
router.register("NFLSummary", views.NFLSummaryView)
router.register("NFLStats", views.NFLStatView)
router.register("DefensiveSummary", views.DefensiveSummaryView)
router.register("D... | 1.726563 | 2 |
src/create_user.py | HcKide/ImageSetClassificationFramework | 0 | 49168 | <reponame>HcKide/ImageSetClassificationFramework
"""Functions for creating users using the coco data. """
import random, os, shutil, time, json
from constants import sub_sets
class UserSampling:
"""Class containing functions for creating users. """
def __init__(self, coco, labels_path=sub_sets, imgs_path=None):
... | 2.65625 | 3 |
models.py | hash2430/pytorch_non_parallel_vc | 1 | 49169 | <gh_stars>1-10
import torch.nn as nn
import modules2 as modules
import torch.nn.functional as F
from hparams import hparam as hp
class Net1(nn.Module):
def __init__(self, phns_len):
super(Net1, self).__init__()
self.prenet = modules.prenet(hp.default.n_mfcc,
hp.... | 2.359375 | 2 |
programs/pgm07_23.py | danielsunzhongyuan/python_practice | 0 | 49170 | #
# This file contains the Python code from Program 7.23 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by <NAME>.
#
# Copyright (c) 2003 by <NAME>, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm07_23.txt
#
class SortedList(OrderedList):
... | 2.984375 | 3 |
rotas/serializers.py | fchevitarese/routecalc | 0 | 49171 | <filename>rotas/serializers.py<gh_stars>0
# encoding: utf-8
from rest_framework import serializers
from .models import Rota
class RotaSerializer(serializers.ModelSerializer):
class Meta:
model = Rota
fields = ('nome', 'origem', 'destino', 'distancia',
'created', 'updated')
clas... | 2.109375 | 2 |
fastapi_for_firebase/cache_control/strategic.py | attakei-sandbox/fastapi-with-firebase | 5 | 49172 | """Strategic cache-control.
Module usage:
1. Plan your cache-control storategy. (ex: "long" caches content until 3600 seconds)
2. Set storategy store to your app.state and add rules.
3. Set cache strategy as Depends to your path routing.
.. code-block: python
app = FastAPI()
strategy = StrategyStore()
stra... | 2.921875 | 3 |
backend/src/msg/jsonMsg.py | frost917/customer-manager | 0 | 49173 | <reponame>frost917/customer-manager
import json
from datetime import datetime
# Dict in List
def authFailedJson():
payload = dict()
convDict = dict()
convList = list()
convDict['error'] = "AuthFailed"
convDict['msg'] = "Authentication Failed!"
convList.append(convDict)
payload['failed'] =... | 2.53125 | 3 |
tests/test_attr_chan.py | wonambi-python/wonambi | 63 | 49174 | <filename>tests/test_attr_chan.py
from nibabel import load as nload
from wonambi.attr import Channels, Freesurfer
from wonambi.attr.chan import (find_channel_groups,
create_sphere_around_elec,
)
from .paths import (chan_path,
fs_path,
... | 2 | 2 |
Taller_Estructuras_de_Control_Selectivas/Ejercicio_15.py | LeonardoJimenezUbaque/Algoritmos_y_Programacion_C4_G2 | 0 | 49175 | """
Ejercicio 15
Tomando como base los resultados obtenidos en un laboratorio de análisis clínicos, un médico determina si una persona tiene anemia o no, lo cual
depende de su nivel de hemoglobina en la sangre, de su edad y de su sexo. Si el nivel de hemoglobina que tiene una persona es menor que el rango
que le corres... | 3.984375 | 4 |
LBP15.py | Anandgowda18/LogicBasedPrograms | 0 | 49176 | '''Program to read a number and check whether it is duck number or not.
Hint: A duck number is a number which has zeros present in it, but no zero present in the begining of the number.
Input Format
a number from the user
Constraints
n>=0
Output Format
Yes or No
Sample Input 0
123
Sample Output 0
No
Sample Inp... | 4.0625 | 4 |
village_api/migrations/0008_alter_relationship_people.py | roseDickinson/dnd-village-api | 1 | 49177 | # Generated by Django 3.2.6 on 2021-08-30 14:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("village_api", "0007_auto_20210830_1327"),
]
operations = [
migrations.AlterField(
model_name="relationship",
name="p... | 1.609375 | 2 |
win/devkit/plug-ins/scripted/mathTableControl.py | leegoonz/Maya-devkit | 10 | 49178 | #-
# ==========================================================================
# Copyright (C) 1995 - 2006 Autodesk, Inc. and/or its licensors. All
# rights reserved.
#
# The coded instructions, statements, computer programs, and/or related
# material (collectively the "Data") in these files contain unpublished... | 0.996094 | 1 |
probe/modules/antivirus/symantec_win/symantec_win.py | krisshol/bach-kmno | 0 | 49179 | <reponame>krisshol/bach-kmno<gh_stars>0
#
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# o... | 2.09375 | 2 |
main.py | snj830526/py_invest_helper | 0 | 49180 | <filename>main.py
import time
import conv
from slack import WebClient
def get_slack_client():
bot_token = conv.get_slack_bot_token()
return WebClient(bot_token)
def working():
counter = 0
client = get_slack_client()
while True:
bot_channel = conv.get_slack_bot_channel()
if clie... | 2.84375 | 3 |
array_cw1.py | cs-fullstack-2019-spring/python-arraycollections-cw-tdude0175 | 0 | 49181 | def main():
# problem1()
# problem2()
# problem3()
# problem4()
problem5()
# Create a function with the variable below. After you create the variable do the instructions below that.
#
# arrayForProblem2 = ["Kenn", "Kevin", "Erin", "Meka"]
# a) Print the 3rd element of the numberList.
#
# b) Pr... | 4.1875 | 4 |
Dep/lbol.py | scigeliu/ViaLacteaVisualAnalytics | 1 | 49182 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 9 11:10:34 2021
@author: smordini
"""
import numpy as np
from scipy import interpolate
def lbol(wavelength,flux,dist):
#function lbol,w,f,d
# interpolation between data points is done in logarithmic space to allow
# straight li... | 2.53125 | 3 |
batch/twitter_setting.py | happou31/dora-stat | 0 | 49183 | <reponame>happou31/dora-stat
consumer_key = "TSKf1HtYKBsnYU9qfpvbRJkxo"
consumer_secret = "<KEY>"
access_token = '<KEY>'
access_secret = '<KEY>'
| 0.964844 | 1 |
scripts/bcf_sample_stats.py | jodyphelan/pathogenseq | 0 | 49184 | #! /usr/bin/env python
import sys
import pathogenseq as ps
import json
infile = sys.argv[1]
ref = sys.argv[2]
outfile = sys.argv[3]
bcf = ps.bcf(infile)
stats = bcf.load_stats(convert=True,ref=ref)
genome_len = sum([len(x) for x in ps.fasta(ref).fa_dict.values()])
print("sample\tnRefHom\tnNonRefHom\tnHets\tnMissing")... | 2.34375 | 2 |
tests/factories/lti_user.py | robertknight/lms | 0 | 49185 | <filename>tests/factories/lti_user.py
from factory import Faker, make_factory
from lms import models
from tests.factories._attributes import OAUTH_CONSUMER_KEY, USER_ID
LTIUser = make_factory( # pylint:disable=invalid-name
models.LTIUser,
user_id=USER_ID,
oauth_consumer_key=OAUTH_CONSUMER_KEY,
roles=... | 2.046875 | 2 |
app/gws/gis/mpx/config.py | ewie/gbd-websuite | 0 | 49186 | import re
import yaml
from mapproxy.wsgiapp import make_wsgi_app
import gws
import gws.config
import gws.tools.os2
import gws.tools.json2
import gws.types as t
class _Config:
def __init__(self):
self.c = 0
self.services = {
'wms': {
'image_formats': ['image/png'],
... | 1.890625 | 2 |
15_flask/projects/first-flask-app-lectures/2-returning-information/app.py | gdia/The-Complete-Python-Course | 29 | 49187 | from flask import Flask
app = Flask(__name__)
posts = {
0: {
'title': 'Hello, world',
'content': 'This is my first blog post!'
}
}
@app.route('/')
def home():
return 'Hello, world!'
# This route expects to be in the format of /post/0 (for example).
# Then it will pass 0 as argument to ... | 3.390625 | 3 |
desafios/desafio041.py | genisyskernel/cursoemvideo-python | 1 | 49188 | from datetime import date
ano_nascimento = int(input("Informe seu ano de nascimento: "))
ano_atual = date.today().year
idade = ano_atual - ano_nascimento
if(idade <= 9):
categoria = "MIRIM"
elif(idade <= 14):
categoria = "INFANTIL"
elif(idade <= 19):
categoria = "JUNIOR"
elif(idade <= 20):
categoria... | 4.125 | 4 |
Algorithms/Searching/BFS_DFS.py | olgarozhdestvina/Python-Practice | 0 | 49189 | # Breadth First Search and Depth First Search
class BinarySearchTree:
def __init__(self):
self.root = None
# Insert a new node
def insert(self, value):
new_node = {
'value': value,
'left': None,
'right': None
}
if not self.root:
... | 4.0625 | 4 |
bot/bot.py | Xithrius/Tabbot | 1 | 49190 | <filename>bot/bot.py
import random
from discord import Game, Message, Status
from discord.ext.commands import Bot
class Tabbot(Bot):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
async def on_ready(self) -> None:
"""Sets the presence of the bot."""
... | 3 | 3 |
STED_analysis/pixel_detect.py | zhaoaite/dynamic_thresholding_algorithm | 3 | 49191 | <filename>STED_analysis/pixel_detect.py
import cv2
import numpy as np
from matplotlib import pyplot as plt
import os
from scipy.stats.stats import pearsonr
def getColors(n):
colors = np.zeros((n, 3))
colors[:, 0] = np.random.permutation(np.linspace(0, 256, n))
colors[:, 1] = np.random.permutation(colors[... | 2.75 | 3 |
spot-oa/api/resources/impala_engine.py | maduhu/Apache-Spot-Incubator | 0 | 49192 | from impala.dbapi import connect
import api.resources.configurator as Config
def create_connection():
impala_host, impala_port = Config.impala()
db = Config.db()
conn = connect(host=impala_host, port=int(impala_port),database=db)
return conn.cursor()
def execute_query(query,fetch=False):
impala... | 2.65625 | 3 |
spacenetutilities/labeltools/geojsonPrepTools.py | Pandinosaurus/utilities | 251 | 49193 | from spacenetutilities.labeltools import coreLabelTools
import json
import glob
import argparse
from datetime import datetime
import os
def modifyTimeField(geoJson, geoJsonNew, featureItemsToAdd=['ingest_tim', 'ingest_time', 'edit_date'], featureKeyListToRemove=[]):
now = datetime.today()
with open(geoJson) a... | 2.390625 | 2 |
xsdata/logger.py | nimish/xsdata | 0 | 49194 | <filename>xsdata/logger.py
import logging
import click_log
logger = logging.getLogger(__name__)
click_log.basic_config(logger)
| 1.648438 | 2 |
Floodgates.py | simbyte404/floodgates-bomber | 0 | 49195 | from os import times
import smtplib
from time import sleep
from getpass import getpass
import sys
class colors():
red = "\u001b[31m"
yel = "\u001b[33m"
gre = "\u001b[32m"
blu = "\u001b[34m"
pur = "\u001b[35m"
cya = "\u001b[36m"
whi = "\u001b[37m"
res = "\u001b[0m"
bred = "\u001b[31;... | 2.640625 | 3 |
fdspsp/particle.py | bangerth/fdspsp | 0 | 49196 | <gh_stars>0
#
# Copyright (c) 2020 by the FireDynamics group
#
# This file is part of the FDS particle spray postprocessor (fdspsp).
#
# fdspsp is free software; you can use it, redistribute it, and/or
# modify it under the terms of the MIT License. The full text of the
# license can be found in the file LICENSE.md at ... | 2.546875 | 3 |
296-Best-Meeting-Point/Python/Solution01.py | Eroica-cpp/LeetCode | 7 | 49197 | <reponame>Eroica-cpp/LeetCode
#!/usr/bin/python
"""
https://leetcode.com/problems/best-meeting-point/
Time O(n^2), Space O(n)
"""
class Solution(object):
def minTotalDistance(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
if not grid or not grid[0]: return
... | 3.1875 | 3 |
Chapter31.DesigningWithClasses/factory.py | mindnhand/Learning-Python-5th | 0 | 49198 | #!/usr/bin/env python3
#encoding=utf-8
#-------------------------------------------------
# Usage: python3 factory.py
# Description: factory function
#-------------------------------------------------
def factory(aClass, *pargs, **kargs): # Varargs tuple, dict
return aClass(*pargs, **kargs) # Call aClass ... | 3.765625 | 4 |
torchdata/datapipes/iter/util/combining.py | Nayef211/data | 0 | 49199 | <reponame>Nayef211/data
# Copyright (c) Facebook, Inc. and its affiliates.
import warnings
from collections import OrderedDict
from torch.utils.data import IterDataPipe, functional_datapipe
@functional_datapipe("zip_by_key")
class KeyZipperIterDataPipe(IterDataPipe):
r""":class:`KeyZipperIterDataPipe`.
Iter... | 2.671875 | 3 |