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 |
|---|---|---|---|---|---|---|
workspaces.py | CC-Digital-Innovation/aws-workspaces-reboot | 1 | 12775251 | # -*- coding: utf-8 -*-
'''
Python CLI wrapper for Amazon Workspaces API
Usage:
workspaces.py get
workspaces.py getallwsids
workspaces.py reboot <WorkspaceId>
workspaces.py test
workspaces.py nuke
Arguments:
WorkspaceId use 'get' to identify a workspace
Options:
-h --help Show t... | 2.578125 | 3 |
efficient_net_v2/model/efficient_net_v2.py | akashAD98/EfficientNetv2-with-Detectron2 | 0 | 12775252 | #!/usr/bin/env python
from copy import deepcopy
import torch.nn as nn
from yacs.config import CfgNode as CN
from ..layers import ConvBNA, MBConv, FusedMBConv
class EfficientNetV2(nn.Module):
def __init__(self, cfg: CN, in_channels: int = 3):
super(EfficientNetV2, self).__init__()
... | 2.234375 | 2 |
storm_control/sc_hardware/utility/corr_2d_gauss_c.py | shiwei23/STORM6 | 1 | 12775253 | <gh_stars>1-10
#!/usr/bin/env python
"""
Fitting for offset using correlation with a 2D Gaussian.
Hazen 04/18
"""
import ctypes
import math
import numpy
from numpy.ctypeslib import ndpointer
import scipy
import scipy.optimize
import tifffile
import storm_control.c_libraries.loadclib as loadclib
# Load C library.
c2... | 2.296875 | 2 |
actusmp/model/term_group.py | CasperLabs/actus-mp | 0 | 12775254 | import dataclasses
import typing
from actusmp.model.term_item import TermSet
@dataclasses.dataclass
class TermGroup():
group_id: str
name: str
term_set: TermSet
def __str__(self) -> str:
return f"term-group|{self.group_id}"
@dataclasses.dataclass
class TermGroupSet():
groups: typing.Li... | 2.625 | 3 |
car_class/car_class.py | Alweezy/bootcamp-18-day-2 | 0 | 12775255 | <reponame>Alweezy/bootcamp-18-day-2
class Car(object):
# setting some default values
num_of_doors = 4
num_of_wheels = 4
def __init__(self, name='General', model='GM', car_type='saloon', speed=0):
self.name = name
self.model = model
self.car_type = car_type
self.speed = s... | 3.796875 | 4 |
common/utils.py | threathunterX/nebula_web | 2 | 12775256 | # -*- coding: utf-8 -*-
import time
from os import path as opath
from datetime import datetime
import jinja2
executor = None # ThreadExecutor
class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`.
>>> o = storage(a=1)
>>>... | 2.84375 | 3 |
pylighter/utils.py | stungkit/PyLighter | 13 | 12775257 | import colorsys
import pkgutil
from dataclasses import dataclass
import pandas as pd
from pylighter import config
def text_parser(file_name, **kwargs):
"""Parse text and replace <% variable %> by the value of variable.
Parameters
----------
file_name : str
Path to the file
Returns
... | 2.96875 | 3 |
Chapter 12/Implement_Trees_with_Lists5_4(b).py | bpbpublications/Advance-Core-Python-Programming | 0 | 12775258 | <reponame>bpbpublications/Advance-Core-Python-Programming
class Tree:
def __init__(self,data):
self.tree = [data, [],[]]
def left_subtree(self,branch):
left_list = self.tree.pop(1)
if len(left_list) > 1:
branch.tree[1]=left_list
self.tree.insert(1,branc... | 4.09375 | 4 |
switchmap/snmp/mib_if.py | PalisadoesFoundation/switchmap-ng | 6 | 12775259 | #!/usr/bin/env python3
"""Class interacts with devices supporting IfMIB. (32 Bit Counters)."""
from collections import defaultdict
from switchmap.snmp.base_query import Query
from switchmap.utils import general
def get_query():
"""Return this module's Query class."""
return IfQuery
def init_query(snmp_ob... | 2.328125 | 2 |
src/pygames/iotgalag/190201_main.py | jaeorin/Python | 0 | 12775260 | import pygame
WHITE = (48, 48, 48)
displaywidth = 470
displayheight = 840
displayobj = None
clock = None
imgbackA = pygame.image.load('image/back.png')
imgbackB = imgbackA.copy()
def iotsetcaption(caption):
pygame.display.set_caption(caption)
def iotbackdraw(image, x, y):
global... | 2.984375 | 3 |
App/Login/views.py | msamunetogetoge/BookRecommendationApp | 0 | 12775261 | import inspect
from django.http.response import JsonResponse
from django.shortcuts import render, redirect
from django.contrib.auth import login, logout
from django.http import HttpResponseBadRequest
from Login.models import M_User, T_Attr
from utils.make_display_data import make_user_config_data
from utils.nee... | 2.234375 | 2 |
src/analysis/plot_network.py | deepqmc/deeperwin | 10 | 12775262 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
target = ["True", "False"]
el_decay = ["True", "False"]
error = np.array([[4.478, 3.483],
[3.647, 2.502]])
fig, ax = plt.subplots()
im = ax.imshow(error)
# We want to show all ticks...
ax.set_xticks(np.arange(len(el_decay)))
a... | 2.953125 | 3 |
MyApi/scrapingApp/models.py | Georgitanev/py_django_scrape | 0 | 12775263 | <reponame>Georgitanev/py_django_scrape
""" model parliament1"""
from django.db import models
class Parliament1(models.Model):
""" model parliament1"""
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=60)
date_born = models.DateField(blank=True, null=True) # date
place_b... | 2.765625 | 3 |
models/db.py | hendrapaiton/mandalika | 1 | 12775264 | # Import from system libraries
from flask_mongoengine import MongoEngine
# MongoEngine load to db variable
db = MongoEngine()
# Function to initialize db to app
def initialize_db(app):
db.init_app(app)
| 2.25 | 2 |
bcbio/variation/varscan.py | markdunning/bcbio-nextgen | 1 | 12775265 | """Provide variant calling with VarScan from TGI at Wash U.
http://varscan.sourceforge.net/
"""
import os
import sys
from bcbio import broad, utils
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
from bcbio.pipeline import config_utils
from bcbio.provenance import do
from bcbio.variation import... | 2.078125 | 2 |
frappe/patches/v12_0/copy_to_parent_for_tags.py | ektai/frappe3 | 0 | 12775266 | <reponame>ektai/frappe3<filename>frappe/patches/v12_0/copy_to_parent_for_tags.py<gh_stars>0
import frappe
def execute():
frappe.db.sql("UPDATE `tabTag Link` SET parenttype=document_type")
frappe.db.sql("UPDATE `tabTag Link` SET parent=document_name")
| 1.023438 | 1 |
config/models.py | pablo-moreno/shitter-back | 0 | 12775267 | from django.db import models
class Deletable(models.Model):
deleted = models.BooleanField(default=False)
def delete(self, *args, **kwargs):
self.deleted = True
return self.save()
class Meta:
abstract = True
| 2.203125 | 2 |
projetos em python/exercicio43.py | gustavo621/projetos-em-python | 0 | 12775268 | peso = float(input("digite aqui o seu peso(kg): "))
altura = float(input("digite sua altura: "))
imc = peso/altura**2
print("seu imc é {:3.2f}".format(imc))
if imc < 18.5:
print("você está abaixo do peso")
elif 18.5 <= imc < 25:
print("parabéns, você está no peso ideal!")
elif 25 <= imc < 30:
print("sobrepe... | 4 | 4 |
bridge/handler/__init__.py | Paula-Kli/IOT | 0 | 12775269 | <filename>bridge/handler/__init__.py
from .message_management import createDeviceInitializationMessage
from .message_handler import SerialHandler
| 1.203125 | 1 |
etl/extract_codebook.py | jbn/anes_recoder | 0 | 12775270 | <reponame>jbn/anes_recoder
#!/usr/bin/env python
import json
import os
import re
from collections import OrderedDict
import modpipe
VERSION_RE = re.compile("^RELEASE VERSION:\s+(\d+)")
LINE_SEP = "=" * 99 + "\n"
DATA_PATH = os.path.join("data", "raw", "anes_timeseries_cdf_codebook_var.txt")
OUTPUT_PATH = os.path.join... | 2.140625 | 2 |
derl/alg/dqn_test.py | MichaelKonobeev/derl | 5 | 12775271 | <reponame>MichaelKonobeev/derl<gh_stars>1-10
# pylint: disable=missing-docstring
from derl.env.make_env import make as make_env
from derl.factory.dqn import DQNFactory
from derl.alg.test import AlgTestCase
class DQNTest(AlgTestCase):
def setUp(self):
super().setUp()
kwargs = DQNFactory.get_kwargs()
kwa... | 1.90625 | 2 |
Server.py | ht21992/Online-Board-Game | 0 | 12775272 | from socket import *
from threading import *
clients = set()
nicknames = []
def clientThread(clientSocket, clientAddress,nickname):
while True:
try:
message = clientSocket.recv(1024).decode("utf-8")
# print(clientAddress[0] + ":" + str(clientAddress[1]) +" says: "+ mess... | 2.9375 | 3 |
debug/__init__.py | Kupoman/BlenderRealtimeEngineAddon | 49 | 12775273 | bl_info = {
"name": "RTE Debug",
"author": "<NAME>",
"blender": (2, 75, 0),
"location": "Info header, render engine menu",
"description": "Debug implementation of the Realtime Engine Framework",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"support": 'TESTING',
"category": "... | 1.773438 | 2 |
flask_table/__init__.py | nullptrT/flask_table | 215 | 12775274 | from .table import Table, create_table
from .columns import (
Col,
BoolCol,
DateCol,
DatetimeCol,
LinkCol,
ButtonCol,
OptCol,
NestedTableCol,
BoolNaCol,
)
| 1.289063 | 1 |
fem_input.py | sepitto/OAPproject2 | 0 | 12775275 | def get_input():
EF1 = float(input("введите значения жесткостей элементов: " + "\n" + "EF1 = "))
EF2 = float(input("EF2 = "))
F = float(input("введите значение усилия:" + "\n" + "F = "))
return EF1, EF2, F | 3.5 | 4 |
build_segments.py | uxai/string-partitioner | 1 | 12775276 | import math
def segment_builder(arg, tail):
req_list = arg[0]
divisions = arg[1]
division_dec = divisions / 100
# number of segments to be created in the element passed
partition_count = int(math.ceil(100 / divisions))
if len(arg) == 3:
segments = arg[2]
else:
g = int(1... | 3.765625 | 4 |
models/classifier.py | AmanDaVinci/Universal-Sentence-Representations | 0 | 12775277 | <filename>models/classifier.py
import torch
import torch.nn as nn
class Classifier(nn.Module):
def __init__(self, encoder, encoded_dim):
super().__init__()
self.encoder = encoder
self.layers = nn.Sequential(
nn.Linear(4 * encoded_dim, 512),
nn.ReLU(),
... | 2.9375 | 3 |
rcommander_plain/src/rcommander_plain/rcommander_default.py | rummanwaqar/rcommander-core | 4 | 12775278 | <gh_stars>1-10
#!/usr/bin/python
import roslib; roslib.load_manifest('rcommander_plain')
import rcommander.rcommander as rc
import rospy
import tf
rospy.init_node('rcommander_plain', anonymous=True)
robot = None
tf = tf.TransformListener()
rc.run_rcommander(['default', 'default_frame', 'plain'], robot, tf)
| 1.773438 | 2 |
python/FastAPI examples/Streaming response example/api.py | andrewguest/code-snippets | 1 | 12775279 | import io
from fastapi import FastAPI
from fastapi.responses import StreamingResponse
from fastapi.staticfiles import StaticFiles
app = FastAPI()
# create a 'static files' directory
# create a '/static' prefix for all files
# serve files from the 'media/' directory under the '/static/' route
# /Big_Buck_Bunny_1080... | 3.125 | 3 |
tictactoe/board.py | iTigrisha/tic-tac-toe | 0 | 12775280 | <gh_stars>0
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return f"[{self.x},{self.y}]"
class X(Point):
def __init__(self, x, y):
super().__init__(x, y)
def __str__(self):
return "X" + super().__str__()
class O(Point):
d... | 3.90625 | 4 |
swarmopt/mopso_agg.py | swarmopt/swarmopt | 6 | 12775281 | import numpy as np
import copy
class Particle:
def __init__(self, lb, ub):
"""Initialize the particle.
Attributes
----------
lb : float
lower bounds for initial values
ub : float
upper bounds for initial values
"""
self.lb = lb
... | 3.484375 | 3 |
player.py | ellyn/tronbots | 2 | 12775282 | import pygame
from pygame.locals import *
from constants import *
from copy import deepcopy
import numpy as np
from heuristic import *
class Player(object):
def __init__(self, color, player_num):
self.color = color
self.direction = UP
self.player_num = player_num
self.move_counter =... | 3.015625 | 3 |
components/elm/src/external_models/sbetr/3rd-party/pfunit/bin/mods/pre/pre.py | meng630/GMD_E3SM_SCM | 0 | 12775283 | #!/usr/bin/env python
# python2 - Deprecated in python 2.7+
import imp
try:
imp.find_module('argparse')
found = True
except ImportError:
found = False
# Preferred for python 2.7+, python 3
# import importlib
# argparse_loader = importlib.find_loader('argparse')
# found = argparse_loader is not None
if fo... | 2.828125 | 3 |
sepaxml/validation.py | CaptainConsternant/python-sepaxml | 53 | 12775284 | <filename>sepaxml/validation.py<gh_stars>10-100
import os
class ValidationError(Exception):
pass
def try_valid_xml(xmlout, schema):
import xmlschema # xmlschema does some weird monkeypatching in etree, if we import it globally, things fail
try:
my_schema = xmlschema.XMLSchema(os.path.join(os.pa... | 2.5625 | 3 |
qolsys_client/mqtt_client.py | mzac/qolsys_client | 7 | 12775285 | import paho.mqtt.client as pmqtt
import paho.mqtt.subscribe as smqtt
import json
import time
import logging
class mqtt:
def __init__(self, broker: str, username: str, password: str, port=1883):
self.client = ""
self.broker = broker
self.port = port
self.username = username
s... | 2.953125 | 3 |
strinks/api/shops/ichigo.py | Zeletochoy/strinks | 1 | 12775286 | import re
from typing import Iterator, Tuple
import requests
from bs4 import BeautifulSoup
from ...db.models import BeerDB
from ...db.tables import Shop as DBShop
from . import NoBeersError, NotABeerError, Shop, ShopBeer
DIGITS = set("0123456789")
def keep_until_japanese(text: str) -> str:
chars = []
for ... | 2.921875 | 3 |
sstcam_simulation/data/__init__.py | sstcam/sstcam-simulation | 1 | 12775287 | <filename>sstcam_simulation/data/__init__.py<gh_stars>1-10
from os.path import join, dirname
from os import environ
import requests
def get_data(path):
return join(dirname(__file__), path)
def download_camera_efficiency_data():
"""
Download the camera efficiency data from the mpi-hd CTA webserver
O... | 2.546875 | 3 |
Desafio73.py | VictorCastao/Curso-em-Video-Python | 0 | 12775288 | print('=' * 12 + 'Desafio 73' + '=' * 12)
tabelabrasileirao = (
"Flamengo", "Santos", "Palmeiras", "Grêmio", "Athletico-PR", "São Paulo", "Internacional", "Corinthians",
"Fortaleza", "Goiás", "Bahia", "Vasco", "Atlético-MG", "Fluminense", "Botafogo", "Ceará", "Cruzeiro", "CSA",
"Chapecoense", "Avaí")
print(... | 3.6875 | 4 |
src/parser/scraper.py | TomMarti/LIL-CRAWLER | 0 | 12775289 | <reponame>TomMarti/LIL-CRAWLER
import requests
class Scraper:
def __init__(self):
self.name = "scraper"
@staticmethod
def scrape(url):
r = None
try:
r = requests.get(url)
except:
return []
if r.status_code == 200:
return Scraper.p... | 3.015625 | 3 |
Hello_world/hello_world.py | elsuizo/Kivy_work | 0 | 12775290 | #= -------------------------------------------------------------------------
# @file hello_world.py
#
# @date 02/14/16 10:41:21
# @author <NAME>
# @email <EMAIL>
#
# @brief
#
# @detail
#
# Licence:
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... | 2.46875 | 2 |
gui_template.py | Llona/AJ-RamDisk | 0 | 12775291 | <gh_stars>0
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Oct 26 2018)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
######################################################################... | 1.671875 | 2 |
app.py | kshitijsriv/vehicle_location_map_folium | 0 | 12775292 | import folium as folium
from flask import Flask, render_template
import rethinkdb as rtdb
import os
from dotenv import load_dotenv
import requests
import json
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
def get_route_polyline(route):
# "http://routesapi.chartr.in/transit/... | 2.71875 | 3 |
venv/lib/python3.6/site-packages/ansible_collections/hetzner/hcloud/plugins/modules/hcloud_server_network.py | usegalaxy-no/usegalaxy | 1 | 12775293 | <reponame>usegalaxy-no/usegalaxy
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Hetzner Cloud GmbH <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTAT... | 2.3125 | 2 |
Knight's Tour Puzzle/game.py | oxxio/hyperskill-projects-python | 0 | 12775294 | def input_dimension():
while True:
dimension = input("Enter your board dimensions: ").split()
len_x1 = 0
len_y1 = 0
if len(dimension) != 2:
print("Invalid dimensions!")
continue
try:
len_x1 = int(dimension[0])
len_y1 =... | 4.03125 | 4 |
keyserv/uuidgenerator.py | Kunin-AI/mini-key-server | 0 | 12775295 | from baseconv import BaseConverter, BASE16_ALPHABET
from uuid import UUID, uuid4
BASE = 16
HEX_DOUBLE_WORD_LENGTH = 8
HEX_DOUBLE_WORD_UPPER_BYTE = slice(-HEX_DOUBLE_WORD_LENGTH, -(HEX_DOUBLE_WORD_LENGTH - 2))
MAX_DOUBLE_WORD = (1 << 31)
OLD_BIT_FLAG = 0x80
NEW_BIT_FLAG_MASK = OLD_BIT_FLAG - 1
BASE16 = BaseConverter(BA... | 2.8125 | 3 |
leetcode/python/41.first-missing-positive.py | phiysng/leetcode | 3 | 12775296 | from typing import List
class Solution:
def firstMissingPositive(self, nums: List[int]) -> int:
for i in range(len(nums)):
while nums[i] > 0 and nums[i] <= len(nums) and nums[nums[i] - 1] != nums[i]:
# nums[i] , nums[nums[i] - 1] = nums[nums[i] - 1] , nums[i]
"""... | 3.78125 | 4 |
python_scripts/LightUpTheNight.py | BenoitCarlier/OpenVoices | 3 | 12775297 | import board
import neopixel
import time
from time import sleep
pixel_pin = board.D18
num_pixels = 8
ORDER = neopixel.RGB
ColorDict = { "black":0x000000, "white":0x101010, "red":0x100000, "blue":0x000010, "green":0x001000, "yellow":0x101000, "orange":0x100600, "pink":0x100508, "teal":0x100508, "teal":0x000808, "purple... | 3.203125 | 3 |
websites/pic/db.py | hmumixaM/anything | 0 | 12775298 | <reponame>hmumixaM/anything<filename>websites/pic/db.py
import pymongo, re, random
uri = "mongodb+srv://hello:qweasdZxc1@jandan-l7bmq.gcp.mongodb.net/code?retryWrites=true&w=majority"
# client = pymongo.MongoClient(host='127.0.0.1', port=27017)
client = pymongo.MongoClient(uri)
# ooxx = client.jandan.comments
ooxx = c... | 2.59375 | 3 |
lasp_reu_python_tutorial_day1.py | michaelaye/LASP-REU-Python | 1 | 12775299 |
# coding: utf-8
# # Using Python to investigate data
# 
# 
# # MANY important non-standard packages
# 
# 
# ## Which Pytho... | 2.40625 | 2 |
google/appengine/tools/devappserver2/devappserver2_test.py | micahstubbs/google_appengine | 0 | 12775300 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 2.390625 | 2 |
ndocker/ovs/__init__.py | codlin/ndocker | 0 | 12775301 | from __future__ import absolute_import
from .vsctl import VSCtl
from .vsctl import VSCtlCmdExecError
from .vsctl import VSCtlCmdParseError | 1.09375 | 1 |
project/bbmdweb/urls.py | kanshao/bbmd_web_ehp | 0 | 12775302 | <reponame>kanshao/bbmd_web_ehp
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from . import api, views
router = DefaultRouter()
router.register(
r'run',
api.RunViewset, base_name="run")
router.register(
r'run/(?P<run_id>\d+)/models',
api.ModelSettingsViews... | 1.976563 | 2 |
users/urls.py | mdribera/noteworthy | 1 | 12775303 | from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
app_name = 'users'
urlpatterns = [
# ex: /users/signup
url(r'^signup/', views.SignupView.as_view(), name='signup'),
# ex: /users/login
url(r'^login/', auth_views.login, name='login'),
# ex: /use... | 1.804688 | 2 |
queries.py | mhmtsker/SamplePortfolio | 0 | 12775304 | query = """select *
from prices
where date > '12.12.2012'""" | 1.789063 | 2 |
tests/test_parser.py | kittinan/twitter_media_downloader | 161 | 12775305 | # coding: utf-8
"""
Unit tests for the parser module.
"""
from ..src.parser import parse_tweet
# pylint: disable=old-style-class,too-few-public-methods
class Struct:
"""Basic class to convert a struct to a dict."""
def __init__(self, **entries):
self.__dict__.update(entries)
USER = Struct(**{
... | 2.859375 | 3 |
container/private/versions.bzl | alexeagle/rules_container | 0 | 12775306 | """Mirror of release info
TODO: generate this file from GitHub API"""
# The integrity hashes can be computed with
# shasum -b -a 384 [downloaded file] | awk '{ print $1 }' | xxd -r -p | base64
TOOL_VERSIONS = {
"7.0.1-rc1": {
"darwin_arm64": "sha384-PMTl7GMV01JnwQ0yoURCuEVq+xUUlhayLzBFzqId8ebIBQ8g8aWnbiRX... | 1.328125 | 1 |
2015/18/solve.py | lamperi/aoc | 0 | 12775307 | with open("input.txt") as file:
data = file.read()
m = [-1, 0, 1]
def neight(grid, x, y):
for a in m:
for b in m:
if a == b == 0:
continue
xx = x+a
yy = y+b
if 0 <= xx < len(grid) and 0 <= yy < len(grid[xx]):
yield grid[xx]... | 3.03125 | 3 |
webpages/admin.py | 18praneeth/udayagiri-scl-maxo | 8 | 12775308 | <gh_stars>1-10
from django.contrib import admin
from .models import Contact
@admin.register(Contact)
class ContactAdmin(admin.ModelAdmin):
pass | 1.28125 | 1 |
mobile_version_app/migrations/0001_initial.py | SakyaSumedh/mobile_version_app | 5 | 12775309 | <reponame>SakyaSumedh/mobile_version_app
# Generated by Django 2.1.7 on 2019-03-01 08:29
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='MobileVersion',
fi... | 1.664063 | 2 |
examples/tests/embed/embed_division.py | chebee7i/ipython | 2 | 12775310 | <filename>examples/tests/embed/embed_division.py
"""This tests that future compiler flags are passed to the embedded IPython."""
from __future__ import division
from IPython import embed
embed(banner1='', header='check 1/2 == 0.5 in Python 2')
embed(banner1='', header='check 1/2 = 0 in Python 2', compile_flags=0)
| 1.65625 | 2 |
optimus/engines/pandas/functions.py | ironmussa/Optimus | 1,045 | 12775311 | <reponame>ironmussa/Optimus
import numpy as np
import pandas as pd
from optimus.engines.base.pandas.functions import PandasBaseFunctions
from optimus.engines.base.dataframe.functions import DataFrameBaseFunctions
class PandasFunctions(PandasBaseFunctions, DataFrameBaseFunctions):
_engine = pd
@staticmetho... | 2.578125 | 3 |
server/face_server/np_utils.py | yichenj/facegate | 0 | 12775312 | import numpy as np
def to_array(image):
array = np.array(image, dtype=np.float32)[..., :3]
array = array / 255.
return array
def l2_normalize(x, axis=0):
norm = np.linalg.norm(x, axis=axis, keepdims=True)
return x / norm
def distance(a, b):
# Euclidean distance
# return np.linalg.norm(a... | 3.34375 | 3 |
scripts/perspective-effects.py | smoh/kinesis | 6 | 12775313 | <reponame>smoh/kinesis
"""Demonstrate perspective rotation/shear/expansion."""
#%%
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import astropy.coordinates as coord
import astropy.units as u
import kinesis as kn
import gapipes as gp
v0 = [-6.3, 45.2, 5.3]
v0 = [-6.3, 5.2, -45.2]
sigmav = 0.0
N... | 2.375 | 2 |
task/vms_report.py | midoks/vms | 1 | 12775314 | # coding: utf-8
#------------------------------
# [从]服务器上报
#------------------------------
import sys
import os
import json
import time
import threading
import subprocess
import shutil
sys.path.append("/usr/local/lib/python2.7/site-packages")
import psutil
root_dir = os.getcwd()
sys.path.append(root_dir + "/class/co... | 2.09375 | 2 |
notes/__init__.py | ibutra/SpyDashServer | 2 | 12775315 | from spydashserver.plugins import PluginConfig
plugin_config = PluginConfig("notes", "notes.Notes", models='notes.models')
| 1.304688 | 1 |
programs/pgm06_02.py | danielsunzhongyuan/python_practice | 0 | 12775316 | #
# This file contains the Python code from Program 6.2 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/pgm06_02.txt
#
class StackAsArray(Stack):
def _... | 3.15625 | 3 |
handcam/scratch/stack_exchange_nn_transfer_plz_help.py | luketaverne/handcam | 1 | 12775317 | <filename>handcam/scratch/stack_exchange_nn_transfer_plz_help.py
from __future__ import print_function
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
import re
import torch
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils import model_zoo
from nn_transfer ... | 2.359375 | 2 |
tests/app/dao/test_inbound_sms_keyword_dao.py | GouvQC/notification-api | 1 | 12775318 | <gh_stars>1-10
from datetime import datetime
from itertools import product
from freezegun import freeze_time
from app.dao.inbound_sms_keyword_dao import (
dao_get_inbound_sms_keyword_for_service,
dao_count_inbound_sms_keyword_for_service,
delete_inbound_sms_keyword_older_than_retention,
dao_get_inbound... | 2.1875 | 2 |
examples/favourites.py | ChrisPenner/tempered | 34 | 12775319 | <filename>examples/favourites.py
# You can write scripts in any language you like to level up your templates!
import sys
print(" and ".join(sys.argv[1:]) + ",")
print("These are a few of my favourite things")
| 2.203125 | 2 |
run_b_to_others.py | MnOpenProject/AutoVideoPub | 25 | 12775320 | <reponame>MnOpenProject/AutoVideoPub
''' 下载自己的B站投稿视频,并上传到我账号登录的其他视频平台上 '''
from from_mybilibili_to_others.main_script import main_func
if __name__ == '__main__':
main_func() | 1.25 | 1 |
neoOkpara/Phase-1/Day2/currentDate.py | CodedLadiesInnovateTech/-python-challenge-solutions | 6 | 12775321 | <reponame>CodedLadiesInnovateTech/-python-challenge-solutions<filename>neoOkpara/Phase-1/Day2/currentDate.py
from datetime import datetime
today = datetime.now()
show = "Current date and time : " + str(today)
print(show)
| 3.6875 | 4 |
algos/td3/core.py | DensoITLab/spinningup_in_pytorch | 11 | 12775322 | <gh_stars>10-100
import torch
import torch.nn as nn
import copy
class continuous_policy(nn.Module):
def __init__(self, act_dim, obs_dim, hidden_layer=(400,300)):
super().__init__()
layer = [nn.Linear(obs_dim, hidden_layer[0]), nn.ReLU()]
for i in range(1, len(hidden_layer)):
la... | 2.515625 | 3 |
vanilla/core.py | byrgazov/vanilla | 0 | 12775323 | <reponame>byrgazov/vanilla
import sys
import collections
import functools
import importlib
import logging
import signal
import heapq
import time
from greenlet import getcurrent
from greenlet import greenlet
import vanilla.exception
import vanilla.message
import vanilla.poll
log = logging.getLogger(__name__)
clas... | 2.484375 | 2 |
deeplearning-holography/deeplearning-cgh/config.py | longqianh/3d-holography | 4 | 12775324 | <reponame>longqianh/3d-holography
class DefaultConfig(object):
env = 'default' # visdom 环境
model = 'SimpleCGH' # 使用的模型,名字必须与models/__init__.py中的名字一致
train_data_root = './data/training_set/' # 训练集存放路径
# test_data_root = './data/test1' # 测试集存放路径
load_model_path =None# 'checkpoints/model.pth' # 加载预训练的模型... | 2.125 | 2 |
ddpg/pendulum_ddpg.py | Jash-2000/reinforcement_learning | 97 | 12775325 | # DDPG Pendulum-v0 example
# ---
# @author <NAME>
# @email luyiren [at] seas [dot] upenn [dot] edu
#
# MIT License
import tensorflow as tf
import numpy as np
import argparse
from ddpg import DDPG
from actor import ActorNetwork
from critic import CriticNetwork
from exp_replay import ExpReplay
from exp_replay import Ste... | 2.3125 | 2 |
nicenquickplotlib/__init__.py | SengerM/nicenquickplotlib | 2 | 12775326 | <filename>nicenquickplotlib/__init__.py
name = "nicenquickplotlib"
from .nq_user_functions import *
| 1.023438 | 1 |
output/output.py | kusuwada/libcollector | 3 | 12775327 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
class Output:
__metaclass__ = ABCMeta
def __init__(self, output, data=None, path=None):
self.output = output
self.data = data
self.path = path
@abstractmethod
def write(self):
pass... | 3.59375 | 4 |
src/ode_sys.py | BardiaMojra/dip | 0 | 12775328 |
''' control systems - ode simulation
@link https://www.youtube.com/watch?v=yp5x8RMNi7o
'''
import numpy as np
from scipy.integrate import odeint
from matplotlib import pyplot as plt
def sys_ode(x, t):
# set system constants
c = 4 # damping constant
k = 2 # spring stiffness constant
m = 20 # point-mass
F... | 3.328125 | 3 |
setup.py | cope-systems/bottle-cgi-server | 0 | 12775329 | <filename>setup.py
#!/usr/bin/env python
import os
from setuptools import setup
def read_reqs(fname):
reqs = []
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
for line in f.readlines():
cleaned = line.split("#")[0].strip()
if cleaned:
reqs.appen... | 2.078125 | 2 |
tests/integration/test_hooks.py | mobidevke/py-fineract | 7 | 12775330 | import random
from fineract.objects.hook import Hook
number = random.randint(0, 10000)
def test_create_hook(fineract):
events = [
{
'actionName': 'DISBURSE',
'entityName': 'LOAN'
},
{
'actionName': 'REPAYMENT',
'entityName': 'LOAN'
... | 2.078125 | 2 |
ApkParse.py | jiania/android-apk-parser | 4 | 12775331 | <reponame>jiania/android-apk-parser
#coding=utf-8
'''
Created on 2015年5月18日
@author: hzwangzhiwei
'''
import os
import re
import zipfile
class ApkParse(object):
'''
DEMO
parse = ApkParse(filename, aapt_path)
parse = ApkParse(u'C:\\Users\\hzwangzhiwei\\Desktop\\mgapp.apk', 'D:/adt_20140321/sdk/build-t... | 2.28125 | 2 |
robot/robot_scenarios/collaborative_task3.py | mauricemager/multiagent_robot | 0 | 12775332 | <filename>robot/robot_scenarios/collaborative_task3.py
import numpy as np
from robot.robot_scenarios.collaborative_tasks import CollScenario
# np.random.seed(7)
class Scenario(CollScenario):
def reset_world(self, world):
"""Overwrite collaborative scenario reset method and add task specific initial state... | 2.90625 | 3 |
src/projects/models.py | bluesnailstw/flamingos | 0 | 12775333 | from django.db import models
from django.contrib.postgres.fields import JSONField, ArrayField
from users.models import User
from django.contrib.auth.models import Group
from django.conf import settings
from asset.models import Host, HostGroup
class Line(models.Model):
name = models.CharField(max_length=255, uniqu... | 2 | 2 |
w11/gauss.py | cagriulas/algorithm-analysis-17 | 0 | 12775334 | import numpy as np
a_matris = [[2,0,0],
[0,2,0],
[0,0,2]]
x_matris = []
b_matris = [2, 4, 9]
u_a_matris = np.triu(a_matris)
x3 = float(b_matris[2])/u_a_matris[2][2]
x2 = float(b_matris[1] - x3*u_a_matris[1][2])/u_a_matris[1][1]
x1 = float(b_matris[0] - x2*u_a_matris[0][1] - x3*u_a_matris[0][2... | 3.140625 | 3 |
eastlake/des_piff.py | des-science/eastlake | 1 | 12775335 | import os
import logging
import galsim
import galsim.config
import piff
import numpy as np
import ngmix
if ngmix.__version__[0:2] == "v1":
NGMIX_V2 = False
from ngmix.fitting import LMSimple
from ngmix.admom import Admom
else:
NGMIX_V2 = True
from ngmix.fitting import Fitter
from ngmix.admom ... | 2.5 | 2 |
allink_core/apps/people/managers.py | allink/allink-core | 5 | 12775336 | # -*- coding: utf-8 -*-
from allink_core.core.models.managers import AllinkCategoryModelQuerySet
class AllinkPeopleQuerySet(AllinkCategoryModelQuerySet):
def title_asc(self, lang):
return self.active()\
.order_by('last_name', 'id')\
.distinct('last_name', 'id')
def title_des... | 2.203125 | 2 |
annotation_app/migrations/0005_sentences_sent_review_comments.py | meisin/annotation_project | 0 | 12775337 | <gh_stars>0
# Generated by Django 3.1.7 on 2021-04-07 23:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('annotation_app', '0004_auto_20210408_0728'),
]
operations = [
migrations.AddField(
model_name='sentences',
... | 1.703125 | 2 |
tests/util/common_test.py | adrianmo/python-ecsclient | 0 | 12775338 | <gh_stars>0
# Standard lib imports
import unittest
# Third party imports
# None
# Project level imports
from ecsclient.util.common import get_formatted_time_string
def suite():
test_suite = unittest.TestSuite()
test_suite.addTest(WhenTestingCommonFunctions())
return test_suite
class WhenTestingCommonF... | 2.640625 | 3 |
blog/admin.py | MysteryCoder456/Blog-App | 3 | 12775339 | from django.contrib import admin
from .models import *
admin.site.register(BlogList)
admin.site.register(Blog)
admin.site.register(Comment)
| 1.289063 | 1 |
backend/tests.py | Marcuse7/openschufa | 46 | 12775340 | import json
from io import BytesIO
def test_ping(app):
client = app.test_client()
resp = client.get('/ping')
data = json.loads(resp.data.decode())
assert resp.status_code == 200
assert 'records' in data['message']
assert 'success' in data['status']
def test_add_user(app):
"""Ensure a ne... | 2.5625 | 3 |
tools/answer_checker.py | CZ-NIC/deckard | 30 | 12775341 | """Functions for sending DNS queries and checking recieved answers checking"""
# pylint: disable=C0301
# flake8: noqa
from ipaddress import IPv4Address, IPv6Address
import random
from typing import Iterable, Optional, Set, Union
import dns.message
import dns.flags
import pydnstest.matchpart
import pydnstest.mock_cli... | 2.8125 | 3 |
fantasyProjectHome/fantasyApp/urls.py | jaredtewodros/cfbFantasyApp | 0 | 12775342 | from django.conf.urls import url
from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('', views.index, name='index'),
path('login/', views.login, name='login'),
] | 1.617188 | 2 |
bokeh/server/server_backends.py | rothnic/bokeh | 1 | 12775343 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2015, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#----------------------------------------... | 2.421875 | 2 |
examples/forms/boostrap.py | mulonemartin/kaira | 3 | 12775344 | from wtforms import StringField, validators
from kaira.app import App
from kaira.response import response
from kaira.wtf import KairaForm
app = App()
class SigninForm(KairaForm):
username = StringField('Username', [validators.Length(min=4, max=25)])
password = StringField('Password', [validators.Length(mi... | 2.265625 | 2 |
Exposure/match_histograms.py | Joevaen/Scikit-image_On_CT | 0 | 12775345 | # 调整图像,使其累积直方图与另一幅图像相匹配,各个通道独立匹配。
import matplotlib.pyplot as plt
from skimage import data, img_as_float, io
from skimage import exposure
from skimage.exposure import match_histograms
reference = io.imread('/home/qiao/PythonProjects/Scikit-image_On_CT/Test_Img/9.jpg')
image = io.imread('/home/qiao/PythonProjects/Sci... | 2.90625 | 3 |
harpoon/src/plugins/Error/Types.py | xezzz/Harpoon | 0 | 12775346 | import discord
from discord.ext import commands
class NotCachedError(commands.CheckFailure):
pass
class PostParseError(commands.BadArgument):
def __init__(self, type, error):
super().__init__(None)
self.type = type
self.error = error | 2.5 | 2 |
cascades.py | stmorse/cascades | 1 | 12775347 | ##########################
# Implementation of Persistent Cascades algorithm
# described in [](https://stmorse.github.io/docs/BigD348.pdf)
# For usage see README
# For license see LICENSE
# Author: <NAME>
# Email: <EMAIL>
# License: MIT License (see LICENSE in top folder)
##########################
import os
impor... | 2.90625 | 3 |
apimetrics_agent/thread.py | APImetrics/Agent | 0 | 12775348 | import logging
import os
from datetime import datetime
import tempfile
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from apimetrics_agent import VERSION
from .controller import handle_api_request
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
cl... | 2.296875 | 2 |
Algorithms/Easy/989. Add to Array-Form of Integer/answer.py | KenWoo/Algorithm | 0 | 12775349 | <gh_stars>0
from typing import List
class Solution:
def addToArrayForm(self, A: List[int], K: int) -> List[int]:
res = []
N = len(A)
S = str(K)
M = len(S)
i = N - 1
j = M - 1
carry = 0
while i >= 0 or j >= 0 or carry != 0:
v = carry
... | 3.265625 | 3 |
iexfinance/tests/stocks/test_market_movers.py | jto-d/iexfinance | 653 | 12775350 | <filename>iexfinance/tests/stocks/test_market_movers.py
import pandas as pd
import pytest
from iexfinance.stocks import (
get_market_gainers,
get_market_iex_percent,
get_market_iex_volume,
get_market_losers,
get_market_most_active,
)
class TestMarketMovers(object):
def test_market_gainers(sel... | 2.34375 | 2 |