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 |
|---|---|---|---|---|---|---|
tests/fixtures.py | SpotDraft/silver-instamojo | 0 | 12781251 | import pytest
from django_dynamic_fixture import G
from silver.models import Transaction, Proforma, Invoice, Customer
from silver import payment_processors
from silver_instamojo.models import InstamojoPaymentMethod
@pytest.fixture
def customer():
return G(Customer, currency='RON', address_1='9', address_2='9',
... | 2.03125 | 2 |
setup.py | arcanosam/pytksync | 0 | 12781252 | <gh_stars>0
""" Packaging and distribution using cx-freeze on Windows Plataform only
"""
import os
import sys
from cx_Freeze import setup, Executable
os.environ['TCL_LIBRARY'] = 'C:\\pysyncdev\\tcl\\tcl8.6'
os.environ['TK_LIBRARY'] = 'C:\\pysyncdev\\tcl\\tk8.6'
build_exe_options = {
'include_msvcr': True, #skip... | 1.78125 | 2 |
sdk/python/pulumi_azure/lighthouse/_inputs.py | aangelisc/pulumi-azure | 0 | 12781253 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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... | 1.859375 | 2 |
Lib/api.py | evi1hack/viperpython | 0 | 12781254 | # -*- coding: utf-8 -*-
# @File : api.py
# @Date : 2021/2/25
# @Desc :
import random
import string
def get_random_str(len):
value = ''.join(random.sample(string.ascii_letters + string.digits, len))
return value
def data_return(code=500, data=None,
msg_zh="服务器发生错误,请检查服务器",
... | 2.8125 | 3 |
waterstructureCreator/check_polarity.py | AlexandraDavila/WaterStructureCreator | 3 | 12781255 | <gh_stars>1-10
import numpy as np
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
# Getting the polarity
def get_structure_polarity(selected_h2o):
"""Check the water structures for polarity
Parameters
----------
selected_h2o : dict
dictionary of the structures
Returns
-----... | 2.734375 | 3 |
twitchbot/disabled_commands.py | jostster/PythonTwitchBotFramework | 0 | 12781256 | from pathlib import Path
from .config import Config
from .command import get_command, command_exist
def is_command_disabled(channel: str, cmd: str):
if channel in cfg_disabled_commands.data:
if command_exist(cmd):
cmd = get_command(cmd).fullname
return cmd in cfg_disabled_commands[ch... | 2.5625 | 3 |
roll.py | es3649/script-tools | 0 | 12781257 | #!/usr/bin/env python3
help_str = """
roll is a tool for computing die rolls
Pass any number of arguments of the form
<number>d<number>
The first number refers to the number of dice to roll;
The second refers to the number of sides on the die.
For example, to roll 5, 6-sided dice, pass '5d6'.
It also computes rolls... | 4.59375 | 5 |
notesnv/cmd_arg_utils.py | knoopx/ulauncher-notes-nv | 4 | 12781258 | """
Utilities for working with command line strings and arguments
"""
import re
from typing import List, Dict, Optional
DOUBLE_QUOTED_GROUPS = re.compile(r"(\".+?\")")
DOUBLE_QUOTED_STRING = re.compile(r"^\".+\"?")
def argsplit(cmd: str) -> List[str]:
"""
Split a command line string on spaces into an argume... | 3.6875 | 4 |
mkalias.py | XiKuuKy/mkalias | 1 | 12781259 | <filename>mkalias.py
import sys
try:
shell = sys.argv[1]
alias = sys.argv[2]
run = sys.argv[3]
run = run.replace('"', "")
run = run.replace("'", "")
except:
print("Usage: \n\tmkalias <shell> <alias> <command>")
sys.exit()
if shell == "zsh" or shell == "bash" or shell == "sh":
print("a... | 2.8125 | 3 |
test/test_cairopen.py | colinmford/coldtype | 142 | 12781260 | import unittest
from coldtype.pens.cairopen import CairoPen
from pathlib import Path
from coldtype.color import hsl
from coldtype.geometry import Rect
from coldtype.text.composer import StSt, Font
from coldtype.pens.datpen import DATPen, DATPens
from PIL import Image
import drawBot as db
import imagehash
import conte... | 2.171875 | 2 |
netbox/extras/migrations/0044_jobresult.py | letic/netbox | 2 | 12781261 | <reponame>letic/netbox<filename>netbox/extras/migrations/0044_jobresult.py
import uuid
import django.contrib.postgres.fields.jsonb
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import extras.utils
from extras.choices import JobResultStatusChoices
def conv... | 2.171875 | 2 |
gevent_ticker/__init__.py | segmentio/gevent-ticker | 2 | 12781262 | from gevent_ticker.ticker import Ticker, ticker
| 1.007813 | 1 |
features/feature_generation_strategy-2.py | jmrozanec/features-generator | 3 | 12781263 | from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.decomposition import PCA, TruncatedSVD, FastICA
from sklearn.random_projection import GaussianRandomProjection, SparseRandomProjection
import abc
class ColumnBasedFeatureGenerationStrategyAbstract(BaseEstimator, TransformerMixin):
"""Provides ab... | 2.359375 | 2 |
testing/il_mimic.py | ioanabica/Invariant-Causal-Imitation-Learning | 12 | 12781264 | <filename>testing/il_mimic.py
import argparse
import os
import pickle
import gym
import numpy as np
import pandas as pd
try:
from paths import get_model_path # noqa
except (ModuleNotFoundError, ImportError):
from .paths import get_model_path # pylint: disable=reimported
from contrib.energy_model import Ene... | 2.140625 | 2 |
Functions.py | AyushAniket/ImageClassification | 0 | 12781265 | # Imports modules
import argparse
import torch
from torchvision import transforms,datasets,models
from PIL import Image
import numpy as np
def get_input_args_train():
parser = argparse.ArgumentParser()
parser.add_argument('--data_dir', type = str, default = 'flowers',
help='data... | 2.78125 | 3 |
algospot/drawrect/answer.py | BK-Yoo/everyday-study | 1 | 12781266 | <filename>algospot/drawrect/answer.py<gh_stars>1-10
from operator import ixor
for _ in range(int(input())):
a = [0, 0]
for i in range(3):
a = list(map(ixor, a, map(int, input().split())))
print(*a)
| 3.15625 | 3 |
inst/python/rpytools/output.py | Mormukut11/R-interface-to-Python | 0 | 12781267 | <reponame>Mormukut11/R-interface-to-Python
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
def start_stdout_capture():
restore = sys.stdout
sys.stdout = StringIO()
return restore
def end_stdout_capture(restore):
output = sys.stdout.getvalue()
sys.stdout.close()... | 2.265625 | 2 |
tests/run_sdl2_mapping.py | justengel/pyjoystick | 3 | 12781268 | from pyjoystick.sdl2 import sdl2, Key, Joystick, ControllerEventLoop, get_mapping, set_mapping
if __name__ == '__main__':
import time
import argparse
devices = Joystick.get_joysticks()
print("Devices:", devices)
monitor = devices[0]
monitor_keytypes = [Key.AXIS]
for k, v in get_mapping(m... | 2.921875 | 3 |
fp/tests/test_datasets.py | ankushjain2001/FairPrep | 8 | 12781269 | import unittest
from fp.traindata_samplers import CompleteData
from fp.missingvalue_handlers import CompleteCaseAnalysis
from fp.scalers import NamedStandardScaler
from fp.learners import NonTunedLogisticRegression, NonTunedDecisionTree
from fp.pre_processors import NoPreProcessing
from fp.post_processors impor... | 2.1875 | 2 |
inktime/fading.py | g-patin/inktime | 0 | 12781270 | <filename>inktime/fading.py
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/03_trajectories-in-od-space.ipynb (unless otherwise specified).
__all__ = [] | 1.125 | 1 |
chapter04/4.4.2_gradient_in_neural.py | Myeonghan-Jeong/deep-learning-from-scratch | 0 | 12781271 | <gh_stars>0
from commons.functions import softmax, cross_entropy_error
from commons.gradient import numerical_gradient
import numpy as np
class simpleNet:
def __init__(self): # init values with one-hot-encoind
self.W = np.random.randn(2, 3)
def predict(self, x):
return np.dot(x, self.W)
... | 2.828125 | 3 |
antimarkdown/handlers.py | Crossway/antimarkdown | 0 | 12781272 | # -*- coding: utf-8 -*-
"""antimarkdown.handlers -- Element handlers for converting HTML Elements/subtrees to Markdown text.
"""
from collections import deque
from antimarkdown import nodes
def render(*domtrees):
if not domtrees:
return ''
root = nodes.Root()
for dom in domtrees:
build_r... | 3.265625 | 3 |
examples/example_06_fit_parallax_EMCEE.py | pmehta08/MulensModel | 0 | 12781273 | """
Fits PSPL model with parallax using EMCEE sampler.
"""
import os
import sys
import numpy as np
try:
import emcee
except ImportError as err:
print(err)
print("\nEMCEE could not be imported.")
print("Get it from: http://dfm.io/emcee/current/user/install/")
print("and re-run the script")
sys.e... | 2.203125 | 2 |
evaluate.py | liuxin811/SRGAN-improved | 0 | 12781274 | <reponame>liuxin811/SRGAN-improved
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 22:41:34 2020
@author: liuxin
"""
import numpy as np
import os
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import Input, Conv2d, BatchNorm2d, Elementwise, SubpixelConv2d, Flatten, Dense, MaxPool... | 1.898438 | 2 |
tornkts/utils.py | ktsstudio/tornkts | 6 | 12781275 | import errno
import mimetypes
from datetime import datetime
import os
import six
from passlib.apps import django10_context as pwd_context
try:
import ujson as json
except:
import json as json
def mkdir(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST ... | 2.28125 | 2 |
code.py | FoamyGuy/CircuitPython-Badge-Reverse-Pong-Game | 0 | 12781276 | import board
import displayio
from adafruit_display_shapes.circle import Circle
import time
from pong_helpers import AutoPaddle, ManualBall
# width and height variables used to know where the bototm and right edge of the screen are.
SCREEN_WIDTH = 160
SCREEN_HEIGHT = 128
# FPS (Frames per second) setting, raise or l... | 3.234375 | 3 |
popularity.py | udit01/Image-Quantization | 1 | 12781277 | import numpy as np
import cv2
import heapq
import statistics
import math
def get_norm(t1 , t2):
(xa, ya, za) = t1
(xb, yb, zb) = t2
return math.sqrt((xa-xb)^2 + (ya-yb)^2 + (za-zb)^2)
def popularity(image,k):
(m,n,_) = image.shape
d = {}
for i in range(m):
for j in range(n):
... | 2.609375 | 3 |
bin/coldbackup/coldbackup.py | destinysky/BackupResourcesController_k8s | 0 | 12781278 | <gh_stars>0
from socketserver import BaseRequestHandler, TCPServer
class EchoHandler(BaseRequestHandler):
def handle(self):
print('Got connection from', self.client_address)
while True:
msg = str(self.request.recv(8192),encoding='utf-8')
print(msg)
if not msg or ... | 2.875 | 3 |
jailscraper/spiders/inmate_spider.py | propublica/cookcountyjail2 | 25 | 12781279 | import boto3
import csv
import logging
import io
import os
import requests
import scrapy
from datetime import date, datetime, timedelta
from jailscraper import app_config, utils
from jailscraper.models import InmatePage
# Quiet down, Boto!
logging.getLogger('boto3').setLevel(logging.CRITICAL)
logging.getLogger('botoc... | 2.34375 | 2 |
fluent_pages/tests/__init__.py | bashu/sigmacms-fluent-pages | 0 | 12781280 | """
Test suite for fluent-pages
"""
import django
if django.VERSION < (1,6):
# Expose for Django 1.5 and below (before DiscoverRunner)
from .test_urldispatcher import UrlDispatcherTests, UrlDispatcherNonRootTests
from .test_menu import MenuTests
from .test_modeldata import ModelDataTests
from .test_... | 1.539063 | 2 |
openpyxl/reader/tests/test_worbook.py | Hitachi-Data-Systems/org-chart-builder | 8 | 12781281 | <reponame>Hitachi-Data-Systems/org-chart-builder
# Copyright (c) 2010-2014 openpyxl
from io import BytesIO
from zipfile import ZipFile
import pytest
from openpyxl.xml.constants import (
ARC_WORKBOOK,
ARC_CONTENT_TYPES,
ARC_WORKBOOK_RELS,
REL_NS,
)
@pytest.fixture()
def DummyArchive():
body = By... | 1.945313 | 2 |
tests/test_executor.py | jackcvr/concurrency | 0 | 12781282 | <reponame>jackcvr/concurrency
import operator
import threading
import time
from concurrent import futures
import pytest
from threadlet import TimeoutError
from threadlet.executor import BrokenThreadPool, ThreadPoolExecutor
def test_executor_shutdown():
max_workers = 4
with ThreadPoolExecutor(max_workers, id... | 2.71875 | 3 |
snpe/run_snpe.py | csarron/MobileAccelerator | 2 | 12781283 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import numpy as np
import os
import tensorflow as tf
import zipfile as zp
import subprocess
import glob
import json
from PIL import Image
from collections import OrderedDict
import shutil
import ... | 2.140625 | 2 |
bin/yap_log.py | Novartis/yap | 23 | 12781284 | #!/usr/bin/env python
"""
Copyright 2014 Novartis Institutes for Biomedical Research
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 ... | 2.3125 | 2 |
act/workers/hybrid_analysis_feed.py | pstray/act-workers | 0 | 12781285 | #!/usr/bin/env python3
"""hybrid-analysis.com worker for the ACT platform
Copyright 2021 the ACT project <<EMAIL>>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all ... | 2.046875 | 2 |
tests/test_licensing_args.py | rackerlabs/openstack-usage-report | 7 | 12781286 | <gh_stars>1-10
import unittest
from usage.args.licensing import parser
class TestLicensingArgs(unittest.TestCase):
"""Tests the arg parser."""
def test_config_file(self):
test_args = ['somefile']
args = parser.parse_args(test_args)
self.assertEquals('/etc/usage/usage.yaml', args.conf... | 2.796875 | 3 |
tests/test_base.py | cluster311/sss-beneficiarios | 0 | 12781287 | from sss_beneficiarios_hospitales.data import DataBeneficiariosSSSHospital
def test_query_afiliado():
dbh = DataBeneficiariosSSSHospital(user='FAKE', password='<PASSWORD>')
res = dbh.query(dni='full-afiliado')
assert res['ok']
data = res['resultados']
assert data['title'] == "Superintendencia de S... | 2.671875 | 3 |
hot_word.py | andyrenpanlong/soubu_app | 0 | 12781288 | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
from pymongo import MongoClient
import requests
from cookielib import CookieJar
import json
import time
import urllib
import urllib2
import ssl
import sys
from soubu_setting import headers
reload(sys)
sys.setdefaultencoding('utf8')
# 搜布网app数据抓取
requests = requests.... | 2.625 | 3 |
Mundo 3/teste02.py | RafaelSdm/Curso-de-Python | 1 | 12781289 | def soma(a,b):
total = a +b
print(total)
def contador (*num):
for c in num:
print(f" {c} ",end='')
print()
for c in num:
tamanho = len(num)
soma(9,2)
soma(6,8)
soma(3,5)
contador(2,4,5)
contador(3,5,6,7,8,)
contador(1,2)
| 3.6875 | 4 |
pyservices/generated/users/user_pb2.py | makkalot/eskit-example-microservice | 0 | 12781290 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: users/user.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _re... | 1.148438 | 1 |
src/948-bag_of_token.py | dennislblog/coding | 0 | 12781291 | <filename>src/948-bag_of_token.py
class Solution(object):
def bagOfTokensScore(self, tokens, P):
"""
:type tokens: List[int]
:type P: int
:rtype: int
@ solution: 用power买第一个credit, 用一个credit兑换400power,加上之前剩下的100,凑齐500买中间200和300两个credit
@ example: tokens = [100... | 3.375 | 3 |
CNN network.py | shohamda/deep-learning | 0 | 12781292 | <reponame>shohamda/deep-learning
# -*- coding: utf-8 -*-
"""<NAME> 204287635 <NAME> 314767674 - DL Assignment 2
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1hUnIpK7OVBXyQ1r-V6VKu_XqQLcy9UdX
**Assignment # 2, CNN over Fasion MNIST**
In this assignm... | 3.765625 | 4 |
start_mirt_pipeline.py | hmirin/guacamole | 141 | 12781293 | <reponame>hmirin/guacamole
#!/usr/bin/env python
"""This file will take you all the way from a CSV of student performance on
test items to trained parameters describing the difficulties of the assessment
items.
The parameters can be used to identify the different concepts in your
assessment items, and to drive your own... | 3.546875 | 4 |
questions-and-answers/dice-with-main/dice_test.py | Wal100/dice_game | 0 | 12781294 | <reponame>Wal100/dice_game<filename>questions-and-answers/dice-with-main/dice_test.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Unit testing."""
import unittest
import dice
class TestDiceClass(unittest.TestCase):
"""Test the class."""
def test_init_default_object(self):
"""Instantiate an ob... | 3.859375 | 4 |
highPerformanceComputing/Project2-KNNClassifier/set.py | naokishami/Classwork | 0 | 12781295 | import pandas as pd
file_romeo = open("./data/romeoandjuliet.csv", "r")
file_moby = open("./data/mobydick.csv", "r")
file_gatsby = open("./data/greatgatsby.csv", "r")
file_hamlet = open("./data/hamlet.csv", "r")
romeo = file_romeo.read()
moby = file_moby.read()
gatsby = file_gatsby.read()
hamlet = file_hamlet.read()... | 3.484375 | 3 |
samples/python/46.teams-auth/bots/__init__.py | Aliacf21/BotBuilder-Samples | 1,998 | 12781296 | <reponame>Aliacf21/BotBuilder-Samples<gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from .dialog_bot import DialogBot
from .teams_bot import TeamsBot
__all__ = ["DialogBot", "TeamsBot"]
| 1.101563 | 1 |
src/voice/preprocessing/audio_preprocessing.py | youngerous/kobart-voice-summarization | 8 | 12781297 | <reponame>youngerous/kobart-voice-summarization
# -*- coding: utf-8 -*-
"""
audio_preprocessing.py
Autor: HyeongwonKang, JeoungheeKim
audio clip resampling and Cropping blanks
예시 : python audio_preprocessing.py -r /data/wings -s resamp_data/wings
"""
## 라이브러리 Import
import numpy as np
import os
import argparse
from t... | 2.421875 | 2 |
server/openapi_server/controllers/text_location_annotation_controller.py | cascadianblue/phi-annotator | 0 | 12781298 | import connexion
from openapi_server.annotator.phi_types import PhiType
from openapi_server.get_annotations import get_annotations
from openapi_server.models.error import Error # noqa: E501
from openapi_server.models.text_location_annotation_request import TextLocationAnnotationRequest # noqa: E501
from openapi_serve... | 2.21875 | 2 |
pyFM/signatures/WKS_functions.py | RobinMagnet/pyFM | 35 | 12781299 | <reponame>RobinMagnet/pyFM
import numpy as np
def WKS(evals, evects, energy_list, sigma, scaled=False):
"""
Returns the Wave Kernel Signature for some energy values.
Parameters
------------------------
evects : (N,K) array with the K eigenvectors of the Laplace Beltrami operator
evals ... | 2.625 | 3 |
bbp/comps/fas.py | kevinmilner/bbp | 0 | 12781300 | #!/usr/bin/env python
"""
Southern California Earthquake Center Broadband Platform
Copyright 2010-2016 Southern California Earthquake Center
"""
from __future__ import division, print_function
# Import Python modules
import os
import sys
import shutil
import matplotlib as mpl
mpl.use('AGG', warn=False)
import pylab
im... | 2.484375 | 2 |
jc_decrypter/utils/files.py | cesarbruschetta/julio-cesar-decrypter | 0 | 12781301 | """ module utils to method to files """
import logging
import hashlib
logger = logging.getLogger(__name__)
def write_file(path: str, source: str, mode="w") -> None:
""" write file in file system in unicode """
logger.debug("Gravando arquivo: %s", path)
with open(path, mode, encoding="utf-8") as f:
... | 3.375 | 3 |
webargscontrib/utils/__init__.py | marcellarius/webargscontrib.utils | 0 | 12781302 | from .string import lowercase, strip
from .types import boolean
from .validate import choices, not_empty, not_null, within
| 1.445313 | 1 |
2.py | envizzion/raspberrypi-sim800l | 0 | 12781303 | <filename>2.py
# SIMSMS1.py
import RPi.GPIO as GPIO
import serial
import time, sys
import datetime
P_BUTTON = 24 # Button, adapt to your wiring
def setup():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(P_BUTTON, GPIO.IN, GPIO.PUD_UP)
SERIAL_PORT = "/dev/ttyAMA0" # Raspberry Pi 2
#SERIAL_PORT = "/dev/ttyS0" # Ras... | 3.140625 | 3 |
tests/test_model_methods/test_load_all.py | naterenegar/ormar | 905 | 12781304 | <filename>tests/test_model_methods/test_load_all.py<gh_stars>100-1000
from typing import List
import databases
import pytest
import sqlalchemy
import ormar
from tests.settings import DATABASE_URL
database = databases.Database(DATABASE_URL, force_rollback=True)
metadata = sqlalchemy.MetaData()
class BaseMeta(ormar.... | 2.296875 | 2 |
pygcms/dispspec.py | dirkenstein/pyspec | 0 | 12781305 | <gh_stars>0
import sys
import operator
#from time import time
import time
import codecs
import re
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import pygcms.msfile.msfileread as mr
import pygcms.msfile.readspec as readspec
import matplotlib
import matplotlib.pyplot as plt
from m... | 2.0625 | 2 |
constants.py | LaudateCorpus1/file-extensions | 15 | 12781306 | '''
Contains package-wide constants.
'''
BASE_URL = 'https://fileinfo.com/filetypes/'
FILE_TYPES = {
'Text': {
'url': 'text',
'path': 'Documents/Text' ,
},
'Data': {
'url': 'datafiles-all',
'path': 'Data',
},
'Audio': {
'url': 'audio-all',
'path': 'M... | 1.445313 | 1 |
2015/day17.py | natedileas/advent-of-code | 0 | 12781307 | import itertools as it
TEST1 = """
20
15
10
5
5
"""
INPUT = open('input17.txt').read()
# def count_ways(containers, total=150):
# ways = 0
# containers = sorted(containers, reverse=True)
# def count(containers, used, stack=0):
# print(containers, used, stack)
# for i in range(len(contai... | 3.375 | 3 |
docs/.src/programs/retrograde_mars.py | astrax/astro2019 | 0 | 12781308 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 23 21:14:48 2018
@author: ahmed
"""
# IMPORTATION
from pylab import *
#plt.style.use('dark_background')
#plt.style.use('ggplot')
import ephem as ep
# deux fonctions supplémentaires du module datetime sont nécessaires
from datetime import datetime ,... | 3.15625 | 3 |
isles/api/pingdom.py | michael-ranieri/Misty | 1 | 12781309 | <gh_stars>1-10
#!/usr/bin/env python
# Copyright (C) 2011 <NAME> <<EMAIL>.d.<EMAIL> at gmail.com>
# System imports
import urllib2
import json
import base64
# Misty imports
import settings_local as settings
def allChecks(iterable):
for i in iterable:
if i['status'] != 'up':
return False
r... | 2.734375 | 3 |
checkmate/contrib/plugins/git/test/__init__.py | marcinguy/checkmate-ce | 80 | 12781310 | import os
import tempfile
import pytest
import subprocess
TEST_DIRECTORY = os.path.abspath(__file__+"/../")
DATA_DIRECTORY = os.path.join(TEST_DIRECTORY,"data")
GIT_TEST_REPOSITORY = DATA_DIRECTORY + "/test_repository/d3py.tar.gz"
| 1.578125 | 2 |
boy/life_class.py | Valden92/Boy-and-boll-TheGame | 1 | 12781311 | import pygame
from pygame.sprite import Sprite
class BoyLife(Sprite):
def __init__(self):
"""Инициализирует графическое отображение жизней."""
super().__init__()
self.image = pygame.image.load('img/heart.png')
self.width = self.image.get_width()
self.height = self.image.get... | 3.28125 | 3 |
isitpublic/app/routes.py | tmidi/flask-isitpublic | 0 | 12781312 | <filename>isitpublic/app/routes.py
from flask import render_template, request
from forms import IpForm
from functions import is_valid_ipv4_address, is_valid_ipv6_address, netmask
from app import app
@app.route('/', methods=['POST', 'GET'])
def index():
form = IpForm()
if request.method == "POST" and form.vali... | 2.921875 | 3 |
features/steps/log-scale-axes.py | eaton-lab/toyplot | 438 | 12781313 | <reponame>eaton-lab/toyplot<filename>features/steps/log-scale-axes.py<gh_stars>100-1000
# Copyright 2014, Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
# rights in this software.
from behave import *
import nose
import numpy
import toy... | 1.820313 | 2 |
file.py | iamchess/asdf | 1 | 12781314 | import pprint
import random
chessBoard = [[0 for j in range(8)] for i in range(8)]
chessBoard[0][0] = "R"
pprint.pprint(chessBoard)
#rook
def move():
x = 0
y = 0
getPosition = [0,0]
chessBoard[0][0] = 0
if random.uniform(0, 2) < 1:
x = int(random.uniform(0, 7))
else:
y = int(ran... | 3.671875 | 4 |
mailchimp_marketing_asyncio/models/inline_response2001_exports.py | john-parton/mailchimp-asyncio | 0 | 12781315 | # coding: utf-8
"""
Mailchimp Marketing API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 3.0.74
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import... | 1.71875 | 2 |
stream/generate/kafkaProd.py | sanjeevkanabargi/python | 0 | 12781316 | <gh_stars>0
#!/usr/bin/env python
import threading, logging, time
import multiprocessing
import sys
from kafka import KafkaConsumer, KafkaProducer
topic = "cfwTopic"
def main():
producer = KafkaProducer(bootstrap_servers='localhost:9092')
filepath = str(sys.argv[1])
with open(filepath) as fp:
... | 2.53125 | 3 |
zeeko/telemetry/tests/test_writer.py | alexrudy/Zeeko | 2 | 12781317 | import pytest
import numpy as np
import zmq
import h5py
import struct
import itertools
from .. import Writer
from .. import chunk_api
from ...messages import array as array_api
from .conftest import assert_chunk_allclose, assert_h5py_allclose
from zeeko.conftest import assert_canrecv
from ...tests.test_helpers import ... | 1.929688 | 2 |
calibration.py | ladsantos/phoenix_pipeline | 0 | 12781318 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import os
from pathlib import Path
from astropy.nddata import CCDData
import ccdproc as ccdp
from astropy.stats import mad_std
import utils as utl
import astropy.units as u
import shutil
#-----------------------------------
#
#---Function to calibrate imag... | 2.3125 | 2 |
app/database/user_db.py | gmbz/frro-soporte-TPI-09 | 2 | 12781319 | from ..models.models import Usuario
from .db import session
from ..models.exceptions import UserAlreadyExists, UserNotFound
from typing import Optional
def register_user(usuario: Usuario) -> Usuario:
"""Agrega un nuevo usuario a la tabla y lo devuelve"""
if user_exists(usuario):
raise UserAlreadyExis... | 2.84375 | 3 |
molecule/default/tests/test_installation.py | Temelio/ansible-role-virtualenv | 0 | 12781320 | """
Role tests
"""
import os
import pytest
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize('name', [
('python-dev'),
('python-virtualenv'),
])
def test_packages(host, name):
""... | 2.140625 | 2 |
cogs/money.py | MrRazamataz/RazBot | 6 | 12781321 | # MrRazamataz's RazBot
# bal cog
import discord
from discord import reaction
from discord.ext import commands
import asyncio
import os
import aiofiles
import json
from discord.ext import tasks
class money(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async... | 2.625 | 3 |
PyLeap_CPB_EyeLights_LED_Glasses_Sparkle/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 12781322 | # SPDX-FileCopyrightText: 2021 <NAME>
# SPDX-License-Identifier: MIT
import board
from adafruit_led_animation.animation.sparkle import Sparkle
from adafruit_led_animation.color import PURPLE
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_is31fl3741.adafruit_ledglasses import MUST_BUFFER, ... | 2.3125 | 2 |
Classifiers/plot_sentiment.py | kanishk2509/TwitterBotDetection | 2 | 12781323 | <reponame>kanishk2509/TwitterBotDetection<filename>Classifiers/plot_sentiment.py<gh_stars>1-10
import matplotlib.pyplot as plt
import csv
def main():
hashtags_user = []
hashtags_bot = []
usermentions_user = []
usermentions_bot = []
rep_user = []
rep_bot = []
tpd_user = []
tpd_bot = []
... | 2.640625 | 3 |
ipodder/feeds.py | sgrayban/CastPodder | 0 | 12781324 | #
# CastPodder feeds module
# Copyright (c) 2005-2006 <NAME> and the CastPodder Team
#
# $Id: feeds.py 147 2006-11-07 08:17:03Z sgrayban $
"""
CastPodder is Copright © 2005-2006 <NAME>
Read the file Software_License_Agreement.txt for more info.
"""
__license__ = "Commercial"
import os
import sys
import stat
import ... | 2.375 | 2 |
ai2business/datasets/test/test_sample_generator.py | Maximilianpy/ai2business | 0 | 12781325 | <reponame>Maximilianpy/ai2business
# Copyright 2020 AI2Business. 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
#
# Un... | 2.109375 | 2 |
modules/interject.py | TBurchfield/bobbit-ng | 0 | 12781326 | # interject.py -----------------------------------------------------------------
import tornado.gen
# Metadata ---------------------------------------------------------------------
NAME = 'interject'
ENABLE = True
TYPE = 'command'
PATTERN = '^!interject (?P<first>[^\s]+) (?P<second>[^\s]+)$'
USAGE = '''Usag... | 2.75 | 3 |
rogysensor.py | ndrogness/RogyGarden | 0 | 12781327 | <reponame>ndrogness/RogyGarden<filename>rogysensor.py
#!/usr/bin/env python3
import time
from collections import namedtuple
try:
from smbus2 import SMBus
except ImportError:
from smbus import SMBus
class RogySensor:
SensorData = namedtuple('SensorData', ['name', 'val', 'units'])
def __init__(self, ... | 2.546875 | 3 |
geonode/geonode/groups/migrations/24_initial.py | ttungbmt/BecaGIS_GeoPortal | 0 | 12781328 | <reponame>ttungbmt/BecaGIS_GeoPortal
# -*- coding: utf-8 -*-
from django.db import migrations, models
from django.conf import settings
import taggit.managers
from django.utils.timezone import now
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
('au... | 1.90625 | 2 |
photoBatch.py | yoderra/photoscan_batch | 0 | 12781329 | <reponame>yoderra/photoscan_batch
#
# <NAME>
# <EMAIL> | <EMAIL>
# Mobile Geospatial Systems Group
# Department of Ecosystem Science and Management
# The Pennsylvania State University
# 2018/06/14
#
# Script to automate PhotoScan v1.3.3 processing.
#!/bin/python
import os, PhotoScan
prin... | 2.3125 | 2 |
pylearn2/data_augmentation.py | BouchardLab/pylearn2 | 0 | 12781330 | from pylearn2.blocks import Block
from pylearn2.utils.rng import make_theano_rng
from pylearn2.space import Conv2DSpace, VectorSpace
import theano
from theano.compile.mode import get_default_mode
class ScaleAugmentation(Block):
def __init__(self, space, seed=20150111, mean=1., std=.05, cpu_only=True):
sel... | 2.3125 | 2 |
qcloudsdkvod/WxPublishRequest.py | f3n9/qcloudcli | 0 | 12781331 | <reponame>f3n9/qcloudcli
# -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class WxPublishRequest(Request):
def __init__(self):
super(WxPublishRequest, self).__init__(
'vod', 'qcloudcliV1', 'WxPublish', 'vod.api.qcloud.com')
def get_SubAppId(self):
return self.get... | 1.851563 | 2 |
modelexp/models/sas/_cube.py | DomiDre/modelexp | 0 | 12781332 | <reponame>DomiDre/modelexp<gh_stars>0
from ._saxsModel import SAXSModel
from fortSAS import cube
from numpy.polynomial.hermite import hermgauss
from numpy.polynomial.legendre import leggauss
class Cube(SAXSModel):
def initParameters(self):
self.params.add('a', 100, min=0)
self.params.add('sldCore', 40e-6)
... | 2.09375 | 2 |
kronos_executor/kronos_executor/executor_schedule.py | ecmwf/kronos | 4 | 12781333 | #!/usr/bin/env python
from kronos_executor.executor import Executor
class ExecutorDepsScheduler(Executor):
"""
An ExecutorDepsScheduler passes a time_schedule of jobs to the real scheduler to be executed.
Certain elements of the ExecutorDepsScheduler can be overridden by the user.
"""
def __init... | 3.046875 | 3 |
tutorial/snippets/views_rest_mixins.py | BennyJane/django-demo | 0 | 12781334 | <reponame>BennyJane/django-demo
from django.http import Http404
from snippets.models import Snippet
from snippets.serializers import SnippetSerializer
from rest_framework import status
from rest_framework import generics
from rest_framework import mixins
from rest_framework.views import APIView
from rest_framework.res... | 2.0625 | 2 |
src/vak/config/predict.py | jspaaks/vak | 26 | 12781335 | """parses [PREDICT] section of config"""
import os
from pathlib import Path
import attr
from attr import converters, validators
from attr.validators import instance_of
from .validators import is_a_directory, is_a_file, is_valid_model_name
from .. import device
from ..converters import comma_separated_list, expanded_u... | 2.515625 | 3 |
plum/util.py | ruancomelli/plum | 153 | 12781336 | <filename>plum/util.py
import abc
import logging
__all__ = ["multihash", "Comparable", "is_in_class", "get_class", "get_context"]
log = logging.getLogger(__name__)
def multihash(*args):
"""Multi-argument order-sensitive hash.
Args:
*args: Objects to hash.
Returns:
int: Hash.
"""
... | 3.21875 | 3 |
listings/syndication/migrations/0001_initial.py | wtrevino/django-listings | 2 | 12781337 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'FeedType'
db.create_table('syndication_feedtype', (
('id', self.gf('django.db.mo... | 2.1875 | 2 |
0_Strings/operators.py | ChristopherDaigle/udemy_python | 0 | 12781338 | # Python has three numeric types:
#
# 1. int: -1
# Python 3 has no integer max size
#
# 2. float: -1.0
# Max value is: 1.7976931348623157e+308
# Min value: 2.2250738585072014e-308
# 52 digits of precision
# Python 3 also has a "Decimal" data type which is more precise
#
# 3. complex: i ** 2
a = 12
b = 3
print(a + b) ... | 4.34375 | 4 |
bin/SchemaUpgrade/versions/4c7ab7d3b46c_version_0_68_007.py | Middlecon/DBImport | 10 | 12781339 | """Version 0.68.007
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2021-10-22 06:59:47.134546
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from sqlalchemy import Enum
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'e3<PASSWORD>4da580'
bra... | 1.828125 | 2 |
tests/server/test_bios_profile.py | ecoen66/imcsdk | 31 | 12781340 | <filename>tests/server/test_bios_profile.py
# Copyright 2016 Cisco Systems, 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 requir... | 2.171875 | 2 |
mesh/vis_utils.py | melonwan/sphereHand | 53 | 12781341 | from __future__ import print_function, division, absolute_import
import pickle
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pickle
def visualize_vertices(vertices:np.ndarray, bones:np.ndarray = None):
fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(vertic... | 2.40625 | 2 |
bert-baselines/bert_models.py | mawdoo3/alue_baselines | 2 | 12781342 | <filename>bert-baselines/bert_models.py<gh_stars>1-10
from transformers import BertPreTrainedModel, BertModel
from torch import nn
from torch.nn import BCEWithLogitsLoss
class BertForMultiLabelSequenceClassification(BertPreTrainedModel):
"""
Bert Model transformer with a multi-label sequence classification hea... | 2.796875 | 3 |
tests/mock.py | asyncee/pycamunda | 0 | 12781343 | <gh_stars>0
# -*- coding: utf-8 -*-
import requests
def raise_requests_exception_mock(*args, **kwargs):
raise requests.exceptions.RequestException
def not_ok_response_mock(*args, **kwargs):
class Response:
ok = False
text = 'text'
content = 'content'
def __bool__(self):
... | 2.734375 | 3 |
project_dashboard/projects/migrations/0015_auto_20180524_1531.py | KruizerChick/project-dashboard | 0 | 12781344 | <gh_stars>0
# Generated by Django 2.0.5 on 2018-05-24 20:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0014_auto_20180524_1438'),
]
operations = [
migrations.AlterField(
model_name='issue',
name=... | 1.492188 | 1 |
examples/embed/plot_cca_comparison.py | idc9/mvlearn | 0 | 12781345 | """
======================
Comparing CCA Variants
======================
A comparison of Kernel Canonical Correlation Analysis (KCCA) with three
different types of kernel to Deep Canonical Correlation Analysis (DCCA).
Each learns and computes kernels suitable for different situations. The point
of this tutorial is to ... | 2.828125 | 3 |
pyvizio/api/base.py | jezzab/pyvizio | 72 | 12781346 | <filename>pyvizio/api/base.py
"""Vizio SmartCast API base commands."""
from abc import abstractmethod
from typing import Any, Dict
class CommandBase(object):
"""Base command to send data to Vizio device."""
def __init__(self, url: str = "") -> None:
"""Initialize base command to send data to Vizio d... | 2.828125 | 3 |
secondstring.py | dssheldon/pands-programs-sds | 0 | 12781347 | <filename>secondstring.py
# The objective of the program is to take a string from a user and
# return every second character in reverse
# Based on Page 32 of "A Whirlwind Tour of Python" by <NAME>
mystring = input('Please input your desired text: ') # Asks users to input a string
rev_mystring = mystring[::-2] # sta... | 4.3125 | 4 |
Latest/venv/Lib/site-packages/pyface/dock/idock_ui_provider.py | adamcvj/SatelliteTracker | 1 | 12781348 | <filename>Latest/venv/Lib/site-packages/pyface/dock/idock_ui_provider.py
#-------------------------------------------------------------------------------
#
# Copyright (c) 2006, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in ent... | 1.601563 | 2 |
deep_talk/__init__.py | ptarau/DeepTalk | 1 | 12781349 | <reponame>ptarau/DeepTalk
#__version__ = '0.1.3'
__all__ = ('dialog_about','txt_quest','pdf_quest', 'pro')
from .qpro import *
| 0.898438 | 1 |
tests/test_sa_integration.py | ChowNow/elixir | 0 | 12781350 | <gh_stars>0
"""
test integrating Elixir entities with plain SQLAlchemy defined classes
"""
from __future__ import absolute_import
from builtins import object
from sqlalchemy.orm import *
from sqlalchemy import *
from elixir import *
class TestSQLAlchemyToElixir(object):
def setup(self):
metadata.bind = "s... | 2.546875 | 3 |