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 |
|---|---|---|---|---|---|---|
setup.py | ManuelMeraz/ReinforcementLearning | 1 | 22200 | #!/usr/bin/env python3
import os
import setuptools
DIR = os.path.dirname(__file__)
REQUIREMENTS = os.path.join(DIR, "requirements.txt")
with open(REQUIREMENTS) as f:
reqs = f.read().strip().split("\n")
setuptools.setup(
name="rl",
version="0.0.1",
description="Reinforcement Learning: An Introduction... | 1.820313 | 2 |
taxcalc/tbi/__init__.py | ClarePan/Tax-Calculator | 1 | 22201 | from taxcalc.tbi.tbi import (run_nth_year_taxcalc_model,
run_nth_year_gdp_elast_model,
reform_warnings_errors)
| 1.195313 | 1 |
mooc_access_number.py | mengshouer/mooc_access_number | 6 | 22202 | <filename>mooc_access_number.py
import requests,time,json,re,base64
requests.packages.urllib3.disable_warnings()
from io import BytesIO
from PIL import Image,ImageDraw,ImageChops
from lxml import etree
from urllib.parse import urlparse, parse_qs
username = "" #登录账号
password = "" #登录密码
s = requests.Sessi... | 2.9375 | 3 |
tests/test_json_api.py | Padraic-O-Mhuiris/fava | 0 | 22203 | # pylint: disable=missing-docstring
from __future__ import annotations
import hashlib
from io import BytesIO
from pathlib import Path
from typing import Any
import pytest
from beancount.core.compare import hash_entry
from flask import url_for
from flask.testing import FlaskClient
from fava.context import g
from fava... | 2.15625 | 2 |
babybuddy/migrations/0017_promocode_max_usage_per_account.py | amcquistan/babyasst | 0 | 22204 | <reponame>amcquistan/babyasst
# Generated by Django 2.2.6 on 2019-11-27 20:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('babybuddy', '0016_auto_20191127_1424'),
]
operations = [
migrations.AddField(
model_name='promocod... | 1.585938 | 2 |
tests/test_upload.py | LuminosoInsight/luminoso-api-client-python | 5 | 22205 | from luminoso_api.v5_client import LuminosoClient
from luminoso_api.v5_upload import create_project_with_docs, BATCH_SIZE
from unittest.mock import patch
import pytest
BASE_URL = 'http://mock-api.localhost/api/v5/'
DOCS_TO_UPLOAD = [
{'title': 'Document 1', 'text': 'Bonjour', 'extra': 'field'},
{'title': 'Do... | 2.328125 | 2 |
src/oca_github_bot/webhooks/on_command.py | eLBati/oca-github-bot | 0 | 22206 | # Copyright (c) initOS GmbH 2019
# Distributed under the MIT License (http://opensource.org/licenses/MIT).
from ..commands import CommandError, parse_commands
from ..config import OCABOT_EXTRA_DOCUMENTATION, OCABOT_USAGE
from ..router import router
from ..tasks.add_pr_comment import add_pr_comment
@router.register("... | 2.515625 | 3 |
splitListToParts.py | pflun/learningAlgorithms | 0 | 22207 | <reponame>pflun/learningAlgorithms
# -*- coding: utf-8 -*-
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def splitListToParts(self, root, k):
res = []
size = 0
traverse = root
... | 3.828125 | 4 |
pmlearn/mixture/tests/test_dirichlet_process.py | john-veillette/pymc-learn | 187 | 22208 | import unittest
import shutil
import tempfile
import numpy as np
# import pandas as pd
# import pymc3 as pm
# from pymc3 import summary
# from sklearn.mixture import BayesianGaussianMixture as skBayesianGaussianMixture
from sklearn.model_selection import train_test_split
from pmlearn.exceptions import NotFittedError
... | 2.359375 | 2 |
algorithms/utils.py | billvb/oblio-game | 2 | 22209 | import random
TUPLE_SIZE = 4
DIGIT_BASE = 10
MAX_GUESS = DIGIT_BASE ** TUPLE_SIZE
def yield_all():
for i in xrange(DIGIT_BASE ** TUPLE_SIZE):
tup = tuple([int(x) for x in '%04d' % i])
assert len(tup) == TUPLE_SIZE
for l in tup:
if tup.count(l) != 1:
break
... | 2.984375 | 3 |
utils/utils.py | cheng052/H3DNet | 212 | 22210 | <reponame>cheng052/H3DNet<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
def conv3x3x3(in_planes, out_planes, stride):
# 3x3x3 convolution with padding
return nn.Conv3d(
in_planes,
out_planes,
kernel_size=3,
stride=stride,
padding=1)... | 2.359375 | 2 |
device/app.py | panjanek/IotCenter | 2 | 22211 | <reponame>panjanek/IotCenter
import logging
import threading
import json
import base64
import os
from subprocess import Popen
import glob
import time
import urllib2
import re
import string
import datetime
class DeviceHandler:
logger = logging.getLogger()
def __init__(self, config):
self.service = None... | 2.21875 | 2 |
deepsource/utils.py | vafaei-ar/deepsource | 0 | 22212 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from skimage import draw
from skimage import measure
from astropy.io import fits
from astropy import units as u
from astropy import wcs, coordinates
from scipy.ndimage.filters impor... | 2.4375 | 2 |
ftc/lib/net/network.py | efulet/ann_text_classification | 0 | 22213 | """
@created_at 2015-01-18
@author <NAME> <<EMAIL>>
"""
from pybrain.datasets import ClassificationDataSet
from pybrain.tools.shortcuts import buildNetwork
from pybrain.structure.modules import SoftmaxLayer
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.utilities import percentError
from pybrain... | 2.703125 | 3 |
python2/probe_yd.py | Nzen/run_ydl | 0 | 22214 | <filename>python2/probe_yd.py<gh_stars>0
from sys import argv
from subprocess import call
try :
link = argv[ 1 ]
except IndexError:
link = raw_input( " - which url interests you? " )
try:
ydl_answ = call( "youtube-dl -F "+ link, shell = True )
if ydl_answ is not 0 :
print "-- failed "+ link + " code "+ str(ydl... | 2.578125 | 3 |
src/cogs/welcome.py | Cr4zi/SynatxBot | 4 | 22215 | <filename>src/cogs/welcome.py
import discord
from discord.ext import commands
from discord import Embed
from discord.utils import get
import datetime
import psycopg2
from bot import DB_NAME, DB_PASS, DB_HOST, DB_USER, logger, private_message
class Welcome(commands.Cog):
def __init__(self, bot):
... | 2.84375 | 3 |
etcd_restore_rebuild_util/edit_yaml_for_rebuild.py | Cray-HPE/utils | 0 | 22216 | #!/usr/bin/env python3
import os
import sys
import yaml
file_name=sys.argv[1]
file_name = '/root/etcd/' + file_name + '.yaml'
with open(file_name) as f:
y=yaml.safe_load(f)
del y['metadata']['creationTimestamp']
del y['metadata']['generation']
del y['metadata']['resourceVersion']
del y['metad... | 2.359375 | 2 |
src/Segmentation/segmentation.py | odigous-labs/video-summarization | 1 | 22217 | import os
import cv2
from Segmentation import CombinedHist, get_histograms, HistQueue
import matplotlib.pyplot as plt
import numpy as np
listofFiles = os.listdir('generated_frames')
# change the size of queue accordingly
queue_of_hists = HistQueue.HistQueue(25)
x = []
y_r = []
y_g = []
y_b = []
def compare(current_h... | 2.625 | 3 |
stickerbot.py | gumblex/stickerindexbot | 1 | 22218 | <filename>stickerbot.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Telegram Sticker Index Bot
'''
import re
import sys
import time
import json
import queue
import sqlite3
import logging
import requests
import functools
import threading
import collections
import concurrent.futures
import zhconv
logging.basic... | 2.34375 | 2 |
tests.py | AndreLouisCaron/requests-wsgi-adapter | 0 | 22219 | <gh_stars>0
import json
import unittest
import requests
from urllib3._collections import HTTPHeaderDict
from wsgiadapter import WSGIAdapter
class WSGITestHandler(object):
def __init__(self, extra_headers=None):
self.extra_headers = extra_headers or tuple()
def __call__(self, environ, start_response... | 2.421875 | 2 |
setup.py | ducandu/aiopening | 0 | 22220 | """
-------------------------------------------------------------------------
shine -
setup
!!TODO: add file description here!!
created: 2017/06/04 in PyCharm
(c) 2017 Sven - ducandu GmbH
-------------------------------------------------------------------------
"""
from setuptools import setup
setup(nam... | 1.1875 | 1 |
podcast_dl/podcasts.py | RMPR/simple-podcast-dl | 0 | 22221 | """
List of podcasts and their filename parser types.
"""
from .rss_parsers import BaseItem, TalkPythonItem, ChangelogItem, IndieHackersItem
import attr
@attr.s(slots=True, frozen=True)
class Podcast:
name = attr.ib(type=str)
title = attr.ib(type=str)
url = attr.ib(type=str)
rss = attr.ib(type=str)
... | 2.765625 | 3 |
07_spitzer_aor_extraction.py | rsiverd/ultracool | 0 | 22222 | #!/usr/bin/env python
# vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 et tw=80 :
#
# Extract and save extended object catalogs from the specified data and
# uncertainty images. This version of the script jointly analyzes all
# images from a specific AOR/channel to enable more sophisticated
# analysis.
#
# <NAME>
# Create... | 2.0625 | 2 |
project/apps/CI-producer/app/producers_test.py | Monxun/PortainerPractice | 0 | 22223 | <gh_stars>0
from os import strerror
import os
import pytest
import datetime
import sqlalchemy
from sqlalchemy import inspect
from sqlalchemy import select
from sqlalchemy.orm import session
from sqlalchemy.sql.expression import func
#################################################
# DATABASE CONNECTOR
user = 'user'... | 2.359375 | 2 |
quran/domain/edition.py | octabytes/quran | 0 | 22224 | from dataclasses import dataclass
from quran.domain.entity import Entity
@dataclass
class Edition(Entity):
id: str
language: str
name: str
translator: str
type: str
format: str
direction: str
| 2.25 | 2 |
dataflow/core/visualization.py | alphamatic/amp | 5 | 22225 | """
Helper functions to visualize a graph in a notebook or save the plot to file.
Import as:
import dataflow.core.visualization as dtfcorvisu
"""
import IPython
import networkx as networ
import pygraphviz
import dataflow.core.dag as dtfcordag
import helpers.hdbg as hdbg
import helpers.hio as hio
def draw(dag: dtf... | 3.25 | 3 |
scripts/pixel_error.py | ling-k/STOVE | 31 | 22226 | """Calculate pixel errors for a single run or all runs in an experiment dir."""
import torch
import itertools
import numpy as np
import imageio
import argparse
import os
import glob
from model.main import main as restore_model
from model.utils.utils import bw_transform
os.environ["CUDA_VISIBLE_DEVICES"] = '-1'
def... | 2.3125 | 2 |
users/admin.py | JVacca12/FIRST | 0 | 22227 | from django.contrib import admin
# Register your models here.
"""User admin classes."""
# Django
from django.contrib import admin
# Models
from users.models import User
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
"""User admin."""
list_display = ('pk', 'username', 'email','first_name','last_na... | 2.140625 | 2 |
mud/migrations/0001_initial.py | lambda-mud-cs18/backend | 1 | 22228 | <reponame>lambda-mud-cs18/backend
# Generated by Django 2.2.3 on 2019-07-31 17:10
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
... | 1.976563 | 2 |
scripts/quest/q22504s.py | G00dBye/YYMS | 54 | 22229 | sm.setSpeakerID(1013000)
sm.sendNext("Ugh. This isn't going to work. I need something else. No plants. No meat. What, you have no idea? But you're the master, and you're older than me, too. You must know what'd be good for me!")
sm.setPlayerAsSpeaker()
sm.sendSay("#bBut I don't. It's not like age has anything to do wi... | 1.632813 | 2 |
user/migrations/0002_user_photo.py | martinlehoux/erp-reloaded | 0 | 22230 | <reponame>martinlehoux/erp-reloaded<gh_stars>0
# Generated by Django 3.0.3 on 2020-03-01 00:58
from django.db import migrations, models
import user.models
class Migration(migrations.Migration):
dependencies = [
('user', '0001_initial'),
]
operations = [
migrations.AddField(
... | 1.59375 | 2 |
core/models/__init__.py | Bhaskers-Blu-Org1/bLVNet-TAM | 62 | 22231 | <reponame>Bhaskers-Blu-Org1/bLVNet-TAM
from .blvnet_tam import bLVNet_TAM
__all__ = ['bLVNet_TAM'] | 1.085938 | 1 |
monodepth/geometry/utils.py | vguizilini/packnet-sfm | 1 | 22232 | # Copyright 2020 Toyota Research Institute. All rights reserved.
"""
Geometry utilities
"""
import numpy as np
def invert_pose_numpy(T):
"""
'Invert' 4x4 extrinsic matrix
Parameters
----------
T: 4x4 matrix (world to camera)
Returns
-------
4x4 matrix (camera to world)
"""
... | 2.71875 | 3 |
minesweeper.py | MrAttoAttoAtto/Cool-Programming-Project | 0 | 22233 | <filename>minesweeper.py
#Minesweeper!
from tkinter import *
import random, time, math, threading, os.path, os
#Tkinter Class
class MinesweeperMain: #Initialising class
def __init__(self, xLength, yLength, percentOfBombs, caller=None, winChoice=True):
try: #kills the 'play again' host (if it exists)
... | 3.421875 | 3 |
cannlytics/utils/scraper.py | mindthegrow/cannlytics | 7 | 22234 | <filename>cannlytics/utils/scraper.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Scrape Website Data | Cannlytics
Copyright © 2021 Cannlytics
Author: <NAME> <<EMAIL>>
Created: 1/10/2021
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redis... | 2.265625 | 2 |
acsm/utils/bird_vis.py | eldar/acsm | 52 | 22235 | <filename>acsm/utils/bird_vis.py
"""
Code borrowed from
https://github.com/akanazawa/cmr/blob/master/utils/bird_vis.py
Visualization helpers specific to birds.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
from torch.autograd import Vari... | 2.328125 | 2 |
gatenlp/corpora/files.py | joancf/python-gatenlp | 30 | 22236 | """
Module that defines Corpus and DocumentSource/DocumentDestination classes which access documents
as lines or parts in a file.
"""
import json
from gatenlp.urlfileutils import yield_lines_from
from gatenlp.document import Document
from gatenlp.corpora.base import DocumentSource, DocumentDestination
from gatenlp.cor... | 2.9375 | 3 |
src/ch5-viewmodels/web/services/AccountPageService.py | saryeHaddadi/Python.Course.WebAppFastAPI | 0 | 22237 | import fastapi
from starlette.requests import Request
from web.viewmodels.account.AccountViewModel import AccountViewModel
from web.viewmodels.account.LoginViewModel import LoginViewModel
from web.viewmodels.account.RegisterViewModel import RegisterViewModel
router = fastapi.APIRouter()
@router.get('/account')
def i... | 2.15625 | 2 |
src/opserver/uveserver.py | madkiss/contrail-controller | 0 | 22238 | #
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# UVEServer
#
# Operational State Server for UVEs
#
import gevent
import json
import copy
import xmltodict
import redis
import datetime
import sys
from opserver_util import OpServerUtils
import re
from gevent.coros import BoundedSemaphore
from pys... | 1.90625 | 2 |
tests/datasets/test_tonas.py | lucaspbastos/mirdata | 224 | 22239 | import numpy as np
from tests.test_utils import run_track_tests
from mirdata import annotations
from mirdata.datasets import tonas
TEST_DATA_HOME = "tests/resources/mir_datasets/tonas"
def test_track():
default_trackid = "01-D_AMairena"
dataset = tonas.Dataset(TEST_DATA_HOME)
track = dataset.track(defa... | 2.25 | 2 |
pycreds.py | Ennovar/aws-creds-test | 7 | 22240 | <reponame>Ennovar/aws-creds-test<gh_stars>1-10
import os
import hashlib
import getpass
import hmac
import botocore.session
import botocore.exceptions
def _hash(value):
return hmac.new(os.environ['TEST_KEY'], value,
digestmod=hashlib.sha256).hexdigest()
def main():
access_key = getpass.g... | 2.375 | 2 |
sopel_modules/urban_dictionary/urbandictionary.py | capsterx/sopel-urbandictionary | 0 | 22241 | <filename>sopel_modules/urban_dictionary/urbandictionary.py
from sopel.module import commands, example
from sopel import web
import sopel.module
import socket
import re
import urbandictionary as ud
BOLD=chr(0x02)
ITALICS=chr(0x1D)
UNDERLINE=chr(0x1F)
def ud_conv(s):
italics = re.sub(r"\[([\w' \"_-]*)\]", f"{U... | 2.609375 | 3 |
Aula01 e exercicios/exercicio_06.py | Dorcival/PYTHON | 0 | 22242 | <filename>Aula01 e exercicios/exercicio_06.py
# Conversor de CELSIUS para FAHRENHEIT v.0.1
# Por <NAME> 202003362174
import time
print("CONVERTER TEMPERATURA DE CELSIUS PARA FAHRENHEIT\n")
c = float(input("Digite a temperatura em CELSIUS: "))
f = float((9 * c)/5)+32
print("\nA temperatura de", c, "graus CELSIUS é igual... | 3.578125 | 4 |
multranslate.py | anoidgit/NMTServer | 3 | 22243 | #encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
import zmq, sys, json
import seg
import detoken
import datautils
from random import sample
serverl=["tcp://127.0.0.1:"+str(port) for port in xrange(5556,5556+4)]
def _translate_core(jsond):
global serverl
sock = zmq.Context().socket(zmq.R... | 2.09375 | 2 |
face_detector.py | duwizerak/Keras_insightface | 0 | 22244 | <gh_stars>0
#!/usr/bin/env python3
import os
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from glob2 import glob
from skimage import transform
from skimage.io import imread, imsave
gpus = tf.config.experimental.list_physical_devices("GPU")
for gpu in gpus:
tf.config.experimental.set_memory_gro... | 1.960938 | 2 |
pyleus/configuration.py | earthmine/pyleus | 166 | 22245 | """Configuration defaults and loading functions.
Pyleus will look for configuration files in the following file paths in order
of increasing precedence. The latter configuration overrides the previous one.
#. /etc/pyleus.conf
#. ~/.config/pyleus.conf
#. ~/.pyleus.conf
You can always specify a configuration file when... | 2.265625 | 2 |
tests/conftest.py | sdrobert/pydrobert-param | 1 | 22246 | from shutil import rmtree
from tempfile import mkdtemp
import pytest
import param
import pydrobert.param.serialization as serial
param.parameterized.warnings_as_exceptions = True
@pytest.fixture(params=["ruamel_yaml", "pyyaml"])
def yaml_loader(request):
if request.param == "ruamel_yaml":
try:
... | 2.015625 | 2 |
tests/test_npaths.py | mtymchenko/npaths | 0 | 22247 | <reponame>mtymchenko/npaths<gh_stars>0
import unittest
import numpy as np
import matplotlib.pyplot as plt
from npaths import NPathNode, Filter, Circulator
__all__ = [
'TestNPathNode',
'TestFilter',
'TestCirculator'
]
GHz = 1e9
ohm = 1
pF = 1e-12
freqs = np.linspace(0.001, 6, 500)*GHz
class TestNPathN... | 2.34375 | 2 |
python/o80_pam/o80_ball.py | intelligent-soft-robots/o80_pam | 0 | 22248 | <reponame>intelligent-soft-robots/o80_pam
import o80
import o80_pam
import context
class _Data:
def __init__(self, observation):
ball_states = observation.get_observed_states()
self.ball_position = [None] * 3
self.ball_velocity = [None] * 3
for dim in range(3):
self.bal... | 2.5 | 2 |
pymic/transform/threshold.py | HiLab-git/PyMIC | 147 | 22249 | <reponame>HiLab-git/PyMIC
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import torch
import json
import math
import random
import numpy as np
from scipy import ndimage
from pymic.transform.abstract_transform import AbstractTransform
from pymic.util.image_process import *
class ChannelWiseTh... | 2.3125 | 2 |
exerc18/18.py | WilliamSampaio/ExerciciosPython | 0 | 22250 | <gh_stars>0
import os
numeros = [0,0]
numeros[0] = float(input('Digite o numero 1: '))
numeros[1] = float(input('Digite o numero 2: '))
print(f'o maior valor entre os dois é: {max(numeros)}')
os.system('pause') | 3.53125 | 4 |
DictionaryOfNewZealandEnglish/headword/citation/views.py | eResearchSandpit/DictionaryOfNewZealandEnglish | 0 | 22251 | # -*- coding: utf-8 -*-
# Citations
from flask import (Blueprint, request, render_template, flash, url_for,
redirect, session)
from flask.ext.login import login_required, current_user
import logging, sys, re
from sqlalchemy.exc import IntegrityError, InvalidRequestError
from DictionaryOfNewZealandE... | 2.4375 | 2 |
tests/conf.py | xncbf/django-dynamodb-cache | 21 | 22252 | <gh_stars>10-100
from random import random
TABLE_NAME = f"test-django-dynamodb-cache-{random()}"
| 1.539063 | 2 |
dockerfiles/greeting/0.2/database.py | scherbertlemon/docker-training | 1 | 22253 | <reponame>scherbertlemon/docker-training
import psycopg2 as pg
import os
"""
Database (Postgres) module connecting to the database for the simple greeting
app.
"""
# The hostname where the database is running can be determined via environment
PGHOST = os.getenv("PG_HOST") if os.getenv("PG_HOST") else "localhost"
de... | 3.40625 | 3 |
generator/constant_aug.py | zhou3968322/pytorch-CycleGAN-and-pix2pix | 0 | 22254 | <reponame>zhou3968322/pytorch-CycleGAN-and-pix2pix<filename>generator/constant_aug.py
# 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
# -*- c... | 1.726563 | 2 |
ooobuild/lo/packages/x_data_sink_encr_support.py | Amourspirit/ooo_uno_tmpl | 0 | 22255 | <gh_stars>0
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... | 1.765625 | 2 |
questions/q197_choose_and_swap/code.py | aadhityasw/Competitive-Programs | 0 | 22256 | class Solution:
def chooseandswap (self, A):
opt = 'a'
fir = A[0]
arr = [0]*26
for s in A :
arr[ord(s)-97] += 1
i = 0
while i < len(A) :
if opt > 'z' :
break
while opt < fir :
if o... | 2.984375 | 3 |
assignment4/assignment4.py | umamibeef/UBC-EECE-560-Coursework | 0 | 22257 | import argparse
import csv
import matplotlib
import matplotlib.ticker as tck
import matplotlib.pyplot as plt
import numpy as np
# Matplotlib export settings
matplotlib.use('pgf')
import matplotlib.pyplot as plt
matplotlib.rcParams.update({
'pgf.texsystem': 'pdflatex',
'font.size': 10,
'font.family': 'ser... | 2.65625 | 3 |
src/python/pants/scm/subsystems/changed.py | lahosken/pants | 1 | 22258 | # coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.buil... | 1.945313 | 2 |
SOLID/LSP/GoodLSPCode.py | maumneto/DesignPatternCourse | 1 | 22259 | class AccountManager(object):
def __init__(self, balance = 0):
self.balance = balance
def getBalance(self):
return self.balance
def withdraw(self, value):
if self.balance >= value:
self.balance = self.balance - value
print('Successful Withdrawal.')
... | 3.671875 | 4 |
test/test_global_customer_api.py | ezmaxinc/eZmax-SDK-python | 0 | 22260 | """
eZmax API Definition (Full)
This API expose all the functionnalities for the eZmax and eZsign applications. # noqa: E501
The version of the OpenAPI document: 1.1.7
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import unittest
import eZmaxApi
from eZmaxApi.api.global_cus... | 1.84375 | 2 |
reconstruction_model.py | JungahYang/Deep3DFaceReconstruction | 1,424 | 22261 | <gh_stars>1000+
import tensorflow as tf
import face_decoder
import networks
import losses
from utils import *
###############################################################################################
# model for single image face reconstruction
##############################################################... | 2.328125 | 2 |
organizational_area/admin.py | mspasiano/uniTicket | 0 | 22262 | <reponame>mspasiano/uniTicket
from django.contrib import admin
from .models import *
from .admin_inlines import *
class AbstractAdmin(admin.ModelAdmin):
list_display = ('name', 'description')
class Media:
js = ('js/textarea-autosize.js',)
css = {'all': ('css/textarea-small.css',),}
@admin.r... | 1.851563 | 2 |
tests/test_symgroup.py | efrembernuz/symeess | 1 | 22263 | import unittest
from cosymlib import file_io
from numpy import testing
from cosymlib.molecule.geometry import Geometry
import os
data_dir = os.path.join(os.path.dirname(__file__), 'data')
class TestSymgroupFchk(unittest.TestCase):
def setUp(self):
self._structure = file_io.read_generic_structure_file(d... | 2.515625 | 3 |
mouth_detecting.py | nuocheng/Face-detection | 0 | 22264 | <reponame>nuocheng/Face-detection<filename>mouth_detecting.py
# -*- coding: utf-8 -*-
# import the necessary packages
from scipy.spatial import distance as dist
from imutils.video import FileVideoStream
from imutils.video import VideoStream
from imutils import face_utils
import numpy as np # 数据处理的库 numpy
import argpars... | 2.46875 | 2 |
Scripts/Ros/Identifica_cor.py | pcliquet/robotic_resumo | 1 | 22265 | <gh_stars>1-10
#! /usr/bin/env python3
# -*- coding:utf-8 -*-
import rospy
import numpy as np
import tf
import math
import cv2
import time
from geometry_msgs.msg import Twist, Vector3, Pose
from nav_msgs.msg import Odometry
from sensor_msgs.msg import Image, CompressedImage
from cv_bridge import CvBridge, CvBridgeErr... | 2.171875 | 2 |
integration_tests/test_test_oracle_tax.py | weblucas/mseg-semantic | 391 | 22266 | <reponame>weblucas/mseg-semantic
#!/usr/bin/python3
from pathlib import Path
from types import SimpleNamespace
from mseg_semantic.scripts.collect_results import parse_result_file
from mseg_semantic.tool.test_oracle_tax import test_oracle_taxonomy_model
REPO_ROOT_ = Path(__file__).resolve().parent.parent
# Replace ... | 1.859375 | 2 |
app/env/lib/python3.7/site-packages/twilio/http/response.py | siyaochen/Tier1Health | 30 | 22267 | class Response(object):
"""
"""
def __init__(self, status_code, text):
self.content = text
self.cached = False
self.status_code = status_code
self.ok = self.status_code < 400
@property
def text(self):
return self.content
def __repr__(self):
retu... | 2.828125 | 3 |
sports_manager/models/gymnasium.py | hbuyse/dj-sports-manager | 0 | 22268 | # -*- coding: utf-8 -*-
"""Gymnasium implementation."""
# Django
from django.core.validators import RegexValidator
from django.db import models
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _ # noqa
class Gymnasium(models.Model):
"""Gymnasium model for the website."... | 2.78125 | 3 |
01-logica-de-programacao-e-algoritmos/Aula 04/1/exercicio01.py | rafaelbarretomg/Uninter | 0 | 22269 | # Exercicio 01 Tuplas
x = int(input('Digite o primeiro numero: '))
y = int(input('Digite o segundo numero: '))
cont = 1
soma = x
while cont < y:
soma = soma + x
cont = cont + 1
print('O resultado eh: {}' .format(soma))
| 4 | 4 |
docs/OOPS/Accessing_pvt_var2.py | munyumunyu/Python-for-beginners | 158 | 22270 | '''
To have a error free way of accessing and updating private variables, we create specific methods for this.
Those methods which are meant to set a value to a private variable are called setter methods and methods
meant to access private variable values are called getter methods.
The below code is an example of g... | 4.25 | 4 |
src/runmanager/runinstance.py | scherma/antfarm | 6 | 22271 | #!/usr/bin/env python3
# coding: utf-8
# MIT License © https://github.com/scherma
# contact http_<EMAIL>4<EMAIL>
import logging, os, configparser, libvirt, json, arrow, pyvnc, shutil, time, victimfiles, glob, websockify, multiprocessing, signal
import tempfile, evtx_dates, db_calls, psycopg2, psycopg2.extras, sys, pca... | 1.914063 | 2 |
test-framework/test-suites/integration/tests/list/test_list_repo.py | sammeidinger/stack | 123 | 22272 | import json
class TestListRepo:
def test_invalid(self, host):
result = host.run('stack list repo test')
assert result.rc == 255
assert result.stderr.startswith('error - ')
def test_args(self, host, add_repo):
# Add a second repo so we can make sure it is skipped
add_repo('test2', 'test2url')
# Run list... | 2.796875 | 3 |
LeetCode/0044_Wildcard_Matching.py | scott-au/PythonAlgorithms | 0 | 22273 | class Solution:
def isMatch(self, s: str, p: str) -> bool:
# this is a dynamic programming solution fot this
matrix = [[False for x in range(len(p) + 1)] for x in range(len(s) + 1)]
matrix[0][0] = True
for i in range(1, len(matrix[0])):
if p[i - 1] == "*":
... | 3.796875 | 4 |
Python/luhnchecksum.py | JaredLGillespie/OpenKattis | 0 | 22274 | # https://open.kattis.com/problems/luhnchecksum
for _ in range(int(input())):
count = 0
for i, d in enumerate(reversed(input())):
if i % 2 == 0:
count += int(d)
continue
x = 2 * int(d)
if x < 10:
count += x
else:
x = str(x)
... | 3.265625 | 3 |
dart_board/plotting.py | GSavathrakis/dart_board | 8 | 22275 | import matplotlib.pyplot as plt
import numpy as np
def plot_chains(chain, fileout=None, tracers=0, labels=None, delay=0, ymax=200000, thin=100, num_xticks=7, truths=None):
if chain.ndim < 3:
print("You must include a multiple chains")
return
n_chains, length, n_var = chain.shape
print(n... | 2.8125 | 3 |
challenge/eval.py | CodeCrawl/deep_learning | 8 | 22276 | ##
## Evaluation Script
##
import numpy as np
import time
from sample_model import Model
from data_loader import data_loader
from generator import Generator
def evaluate(label_indices = {'brick': 0, 'ball': 1, 'cylinder': 2},
channel_means = np.array([147.12697, 160.21092, 167.70029]),
data... | 2.453125 | 2 |
PaddleRec/tdm/tdm_demo/infer_network.py | danleifeng/models | 2 | 22277 | # -*- coding=utf-8 -*-
"""
# Copyright (c) 2020 PaddlePaddle 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... | 2.34375 | 2 |
fixtures/requests.py | AzatAza/december-api-tests | 0 | 22278 | import requests
from requests import Response
class Client:
@staticmethod
def request(method: str, url: str, **kwargs) -> Response:
"""
Request method
method: method for the new Request object: GET, OPTIONS, HEAD, POST, PUT, PATCH, or DELETE. # noqa
url – URL for the new Reques... | 3.390625 | 3 |
rules_default/castervoice/lib/ctrl/mgr/grammar_container/base_grammar_container.py | MLH-Fellowship/LarynxCode | 1 | 22279 | <reponame>MLH-Fellowship/LarynxCode<filename>rules_default/castervoice/lib/ctrl/mgr/grammar_container/base_grammar_container.py
from castervoice.lib.ctrl.mgr.errors.base_class_error import DontUseBaseClassError
class BaseGrammarContainer(object):
def set_non_ccr(self, rcn, grammar):
raise DontUseBaseClas... | 1.695313 | 2 |
main/urls.py | homata/snow_removing | 2 | 22280 | <filename>main/urls.py
from django.urls import include, path
from . import views
from django.views.generic.base import RedirectView
# アプリケーションの名前空間
# https://docs.djangoproject.com/ja/2.0/intro/tutorial03/
app_name = 'main'
urlpatterns = [
path('', views.index, name='index'),
]
| 1.929688 | 2 |
server/server/urls.py | oSoc17/lopeningent_backend | 4 | 22281 | """server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | 2.71875 | 3 |
app/backend/knowledge_base_approach/python-client/swagger_client/api/default_api.py | e-lubrini/fake-news-detector | 0 | 22282 | <gh_stars>0
# coding: utf-8
"""
FRED API
FRED is a tool for automatically producing RDF/OWL ontologies and linked data from natural language sentences. The method is based on Combinatory Categorial Grammar, Discourse Representation Theory, Linguistic Frames, and Ontology Design Patterns. Results are enriched ... | 2.125 | 2 |
geesedb/interpreter/metadata.py | informagi/GeeseDB | 12 | 22283 | import json
from ..connection import get_connection
class Metadata:
def __init__(self, database):
self.connection = get_connection(database).connection
# first list is default if nothing is specified (should be extended)
# list is ordered as [edge_name, node1_id, edge_node1_id, edge_node2_id, n... | 2.59375 | 3 |
content_feeders/in.py | Giapa/ContentAggregator | 0 | 22284 | import requests
from bs4 import BeautifulSoup
def getSummary(link):
#Get page response
response = requests.get(link)
#Parse the pgae
soup = BeautifulSoup(response.content,'html.parser')
#Find first paragraph
summary_p = soup.find('p')
#Get the first text
summary = summary_p.text[:40] + ... | 3.3125 | 3 |
resources/lib/database_tv.py | bradyemerson/plugin.video.showtimeanytime | 0 | 22285 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
from datetime import date, datetime
from sqlite3 import dbapi2 as sqlite
from bs4 import BeautifulSoup
import simplejson as json
import xbmcvfs
import xbmcgui
import common
import connection
import database_common as db_common
def create():
c = _datab... | 2.4375 | 2 |
apps/configuration/editions/base.py | sotkonstantinidis/testcircle | 3 | 22286 | import copy
from configuration.configuration import QuestionnaireConfiguration
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import F
from django.template.loader import render_to_string
from configuration.models import Configuration, Key, Value, Translati... | 2.171875 | 2 |
EyePatterns/main_test_all_clusters.py | Sale1996/Pattern-detection-of-eye-tracking-scanpaths | 1 | 22287 | import matplotlib.pyplot as plt
import distance
from matplotlib import style
from clustering_algorithms.affinity_propagation import AffinityPropagation
from clustering_algorithms.custom_k_means import KMeans
from clustering_algorithms.custom_mean_shift import MeanShift
from clustering_algorithms.custom_mean_shift_strin... | 2.703125 | 3 |
src/onevision/cv/imgproc/color/integer.py | phlong3105/onevision | 2 | 22288 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Conversion between single-channel integer value to 3-channels color image.
Mostly used for semantic segmentation.
"""
from __future__ import annotations
import numpy as np
import torch
from multipledispatch import dispatch
from torch import Tensor
from onevision.cv.... | 3.203125 | 3 |
doepy/problem_instance.py | scwolof/doepy | 1 | 22289 | <reponame>scwolof/doepy
"""
MIT License
Copyright (c) 2019 <NAME>
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... | 1.992188 | 2 |
snuba/datasets/dataset_schemas.py | Appva/snuba | 0 | 22290 | from typing import Optional, List, Sequence, Union
from snuba.datasets.schemas import Schema
from snuba.datasets.schemas.tables import TableSchema, WritableTableSchema
class DatasetSchemas(object):
"""
A collection of schemas associated with a dataset, providing access to schemas and DDL functions
"""
... | 2.59375 | 3 |
Benchmarking/benchmark_alphabet_increase.py | icezyclon/AALpy | 61 | 22291 | from statistics import mean
import csv
from aalpy.SULs import DfaSUL, MealySUL, MooreSUL
from aalpy.learning_algs import run_Lstar
from aalpy.oracles import RandomWalkEqOracle
from aalpy.utils import generate_random_dfa, generate_random_mealy_machine, generate_random_moore_machine
num_states = 1000
alph_size = 5
rep... | 2.296875 | 2 |
makehuman-master/makehuman/plugins/9_export_obj/mh2obj.py | Radiian-Arts-Main/Radiian-Arts-BioSource | 1 | 22292 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** <NAME>, <NAME>
**Copyright(c):** MakeHuman Team 2001-2019
**... | 1.742188 | 2 |
util/plot_model.py | libccy/inv.cu | 0 | 22293 | #!/usr/bin/env python
import sys
from os.path import exists
import numpy as np
import pylab
import scipy.interpolate
def read_fortran(filename):
""" Reads Fortran style binary data and returns a numpy array.
"""
with open(filename, 'rb') as f:
# read size of record
f.seek(0)
n = np.fromfile(f, dtype='int32... | 2.96875 | 3 |
python/plugins/db_manager/db_plugins/oracle/data_model.py | dyna-mis/Hilabeling | 0 | 22294 | <filename>python/plugins/db_manager/db_plugins/oracle/data_model.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS (Oracle)
Date : Aug 27, 2014
... | 1.179688 | 1 |
Opencv1/prayog4.py | priyanshgupta1998/Image_Processing | 0 | 22295 | # with the TRACKBAR gui component
# we can perform some action my moving cursor
import cv2
import numpy as np
def funk(): # create one funciton # Now we are not adding any action in it . # just pass
pass
def main():
img1 = np.zeros((512,512,3) , np.uint8) # create a imgae of size 512 x512
... | 3.765625 | 4 |
qiushaoyi/study_practices/qiushaoyi_study_path/L2_Module.py | qsyPython/Python_play_now | 2 | 22296 | <reponame>qsyPython/Python_play_now<gh_stars>1-10
import sys
from PIL import Image
from enum import Enum, unique
# 模块: cd 文件夹路径 再ls ,读取文件! 若是上级界面,路径: ./
im = Image.open('test.png')
print(im.format, im.size, im.mode)
# 面向过程:函数化!!!
# 面向对象(Object Oriented Programming,简称OOP):对象化(包含数据和函数)!!!高度封装
std1 = {'name': 'Machileg... | 2.9375 | 3 |
2019/day-03/3.py | Valokoodari/advent-of-code | 2 | 22297 | inputFile = "3-input"
outputFile = "3-output"
dir = {'L': [-1,0],'R': [1,0],'U': [0,1],'D': [0,-1]}
def readFile():
file = open(inputFile, "r")
A,B = file.readlines()
A,B = [line.split(",") for line in [A,B]]
file.close()
return A,B
def writeFile(a, b):
file = open(outputFile, "w+")
fil... | 3 | 3 |
notebook/3_tst_3dep.py | ACWI-SSWD/nldi_el_serv | 0 | 22298 | from nldi_el_serv.XSGen import XSGen
from nldi_el_serv.dem_query import query_dems_shape
import py3dep
from pynhd import NLDI
gagebasin = NLDI().get_basins("06721000").to_crs('epsg:3857')
gageloc = NLDI().getfeature_byid("nwissite", "USGS-06721000").to_crs('epsg:3857')
cid = gageloc.comid.values.astype(str)
print(cid... | 2.15625 | 2 |
Python/Product/Pyvot/Pyvot/setup.py | mikiec84/PTVS | 3 | 22299 | # PyVot
# Copyright(c) Microsoft Corporation
# 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
#
# THIS CODE IS PROVIDED ON AN ... | 1.96875 | 2 |