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 |
|---|---|---|---|---|---|---|
AtC_Beg_Con_081-090/ABC090/B.py | yosho-18/AtCoder | 0 | 12766551 | a, b = map(int, input().split())
a = str(a)
b = str(b)
count = 0
c = int(a)
d = int(b)
for i in range(c, d + 1):
i = str(i)
if i[0] == i[4] and i[1] == i[3]:
count += 1
print(count) | 3.015625 | 3 |
test/Inputs/getmtime.py | xjc90s/swift | 1 | 12766552 | <filename>test/Inputs/getmtime.py
#!/usr/bin/env python3
import os
import sys
print(os.path.getmtime(sys.argv[1]))
| 1.765625 | 2 |
tests/test_generator.py | frankie567/cookiecutter-eventually-landing | 0 | 12766553 | import importlib.util
import os.path
import pytest
import shutil
import unittest
from cookiecutter.main import cookiecutter
def load_module_from_path(module_name, path):
module_spec = importlib.util.spec_from_file_location(module_name, path)
module = importlib.util.module_from_spec(module_spec)
module_sp... | 2.390625 | 2 |
datadef.py | ffee21/socialmap-korea | 0 | 12766554 | import os
from gcloud import datastore
def selectAll(client, kind, order=None):
query = client.query(kind=kind)
if order: query.order = order
resultlist = list(query.fetch())
return resultlist
def deleteAll(client, kind):
all = selectAll(client, kind)
keylist = list(map(lambda x:... | 2.5 | 2 |
preprocessing/preprocessing.py | jwheatp/twitter-riots | 0 | 12766555 | <reponame>jwheatp/twitter-riots
# imports
import json
import math
import sys
import nltk
import re
import csv
from datetime import datetime,timedelta
# global variables
lancaster = nltk.LancasterStemmer()
def tokenize(raw) :
"""Tokenizing a string"""
return nltk.word_tokenize(raw)
def stem(tokens) :
"""S... | 2.9375 | 3 |
setup.py | DHI/fmdap | 1 | 12766556 | <reponame>DHI/fmdap<gh_stars>1-10
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("LICENSE") as fh:
license = fh.read()
setuptools.setup(
name="fmdap",
version="0.1.dev3",
install_requires=[
"numpy",
"pandas",
"matplotlib",
... | 1.617188 | 2 |
elegantrl/envs/starcraft/smac_maps.py | tnerush71/ElegantRL | 759 | 12766557 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from pysc2.maps import lib
from smac.env.starcraft2.maps import smac_maps
map_param_registry = {
"1o_10b_vs_1r": {
"n_agents": 11,
"n_enemies": 1,
"limit": 50,
"a_race": "Z"... | 2.3125 | 2 |
PowerScriptast.py | twtg93/PowerScript | 1 | 12766558 | import collections
BOOL = {"BOOLAND", "BOOLOR", "BOOLNOT"}
POW = {"POW"}
MUL_DIV = {"MUL", "DIV"}
ADD_SUB = {"ADD", "SUB"}
SHIFT = {"LSHIFT", "RSHIFT"}
BIN = {"AND", "OR", "XOR"}
CMP = {"EQ", "NEQ", "LEQ", "GEQ", "LT",
"GT", "CONTAINS", "CONTAINED"}
NODES = {
"UnaryExpr": "op val",
"BinExpr": "op left righ... | 2.53125 | 3 |
Examples/charlcd_rpi_mono_simpletest.py | pmartel/CircuitPyDisk | 3 | 12766559 | """Simple test for monochromatic character LCD on Raspberry Pi"""
import time
import board
import digitalio
import adafruit_character_lcd.character_lcd as characterlcd
# Modify this if you have a different sized character LCD
lcd_columns = 16
lcd_rows = 2
# Raspberry Pi Pin Config:
lcd_rs = digitalio.DigitalInOut(boa... | 3.265625 | 3 |
src/nsupdate-interactive.py | perryflynn/nsupdate-interactive | 2 | 12766560 | #!/usr/bin/python3
import os
import sys
import re
import argparse
import subprocess
import shlex
import shutil
import datetime
from zoneutils import zonefile, zonefileformatter, nsupdate, utils
SLUG_RGX = re.compile(r"[^a-zA-Z0-9_]")
def parse_args():
""" Parse command line arguments """
parser = argparse... | 2.875 | 3 |
src/momento/simple_cache_client.py | momentohq/client-sdk-python | 0 | 12766561 | import asyncio
from types import TracebackType
from typing import Optional, Mapping, Union, Type
from .aio import simple_cache_client as aio
from ._async_utils import wait_for_coroutine
from .cache_operation_types import (
CacheGetResponse,
CacheSetResponse,
CacheDeleteResponse,
CreateCacheResponse,
... | 2.375 | 2 |
test/test-maps-map.py | bartaelterman/pygbif | 37 | 12766562 | <gh_stars>10-100
"""Tests for maps module - maps"""
import pytest
import unittest
import vcr
import requests
import matplotlib
matplotlib.use("Agg")
import pygbif
class TestMapsClass(unittest.TestCase):
@vcr.use_cassette("test/vcr_cassettes/test_map.yaml")
def test_map(self):
"maps.map - basic test"
... | 2.4375 | 2 |
ddpro_website/base_ui/admin.py | Rolloniel/ddpro_website_backend | 0 | 12766563 | <reponame>Rolloniel/ddpro_website_backend
from django.contrib import admin
from .models import About, TeamMember, Product
@admin.register(About)
class AboutAdmin(admin.ModelAdmin):
list_display = ['heading', 'text_html']
@admin.register(TeamMember)
class TeamMemberAdmin(admin.ModelAdmin):
list_display = ['fir... | 1.84375 | 2 |
run.py | Divisibility/l5r-game-master-tool | 2 | 12766564 | #!/usr/bin/env python
from gmt import app
app.run(debug=app.config['DEBUG'], port=app.config['PORT'])
| 1.4375 | 1 |
worker/jobs/register.py | jlbrewe/hub | 30 | 12766565 | import io
import json
import logging
import os
import re
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple
import httpx
from jobs.base.job import Job
from jobs.convert import Convert
logger = logging.getLogger(__name__)
class Register(Job):
"""
A job that registers a DOI wit... | 2.28125 | 2 |
ingenico/connect/sdk/log/sys_out_communicator_logger.py | Ingenico-ePayments/connect-sdk-python2 | 2 | 12766566 | from __future__ import print_function
from datetime import datetime
from threading import Lock
from ingenico.connect.sdk.log.python_communicator_logger import \
CommunicatorLogger
class SysOutCommunicatorLogger(CommunicatorLogger):
"""
A communicator logger that prints its message to sys.stdout
It i... | 2.84375 | 3 |
MoireTest/dealjpg.py | YuLingFengSCNU2017/MoireFitting | 1 | 12766567 | <gh_stars>1-10
"""=========================================================================================
Date : 2020.03.20
Author : 玩具反斗星
WeChat : SCNU20172321114
Note : 1、本程序用于莫尔条纹的精确检测与计数。
2、请确保运行环境正确,在运行前请先测试图像是否清晰。
3、本程序针对的对象为与水平成-45°≤α≤45°的莫尔条纹的竖直运动。
4、莫尔条纹与水平面成倾斜角越接近... | 2.1875 | 2 |
lectures/code/mpl_wire.py | naskoch/python_course | 4 | 12766568 | from mpl_toolkits.mplot3d import axes3d
ax = plt.subplot(111, projection='3d')
X, Y, Z = axes3d.get_test_data(0.1)
ax.plot_wireframe(X, Y, Z, linewidth=0.1)
plt.savefig('wire.pdf')
| 2.203125 | 2 |
ABInBev Bot/databaseconn.py | Aryamaan23/IVR-chatbot | 33 | 12766569 | import mysql.connector
def DataUpdate(Name,Email,Contact):
mydb=mysql.connector.connect(
host="localhost",
user="root",
passwd="<PASSWORD>",
database="mail_signups",
auth_plugin='mysql_native_password'
)
mycursor=mydb.cursor()
#sql="CREATE TABLE CustomersInfo (... | 3.078125 | 3 |
tests/cyclic/bar.py | topwebmaster/factory_boy | 1,932 | 12766570 | # Copyright: See the LICENSE file.
"""Helper to test circular factory dependencies."""
import factory
class Bar:
def __init__(self, foo, y):
self.foo = foo
self.y = y
class BarFactory(factory.Factory):
class Meta:
model = Bar
y = 13
foo = factory.SubFactory('cyclic.foo.Foo... | 2.828125 | 3 |
django_todos/todos/migrations/0003_auto_20180418_2216.py | squadran2003/django-todos | 0 | 12766571 | # Generated by Django 2.0.4 on 2018-04-18 22:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todos', '0002_auto_20180418_2213'),
]
operations = [
migrations.AlterField(
model_name='status',
name='status',
... | 1.625 | 2 |
Pynq-ZU/base/notebooks/rpi/SenseHat/sensehat/lps25h.py | Zacarhay/PYNQ-ZU | 6 | 12766572 | <filename>Pynq-ZU/base/notebooks/rpi/SenseHat/sensehat/lps25h.py
# Copyright (c) 2020, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code... | 0.65625 | 1 |
src/view/widgets/field_lookup.py | gustavosaquetta/FrameworkSSQt-Vocatus | 0 | 12766573 | import os, sys
sys.path.append(os.getcwd())
from PyQt5.QtWidgets import QApplication, QWidget
from src.controller.lib.ssqt import SSQt
SSQt.load_uifile(True, 'src/view/widgets/ui/field_lookup.ui')
from src.view.widgets.ui.field_lookup import Ui_FieldLookup
class FieldLookupView(QWidget, Ui_FieldLookup, SSQt):
def ... | 2.578125 | 3 |
utils_ucsi.py | iofthetiger/ucsi | 1 | 12766574 | <gh_stars>1-10
import os
import cv2
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import albumentations as albu
from albumentations import pytorch as AT
import torchvision
import torchvision.transforms as transforms
import torch
from torch import nn
import segmentation_models_pytorch as... | 2.4375 | 2 |
setup.py | bhalevy/scylla-stress-orchestrator | 3 | 12766575 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name='scyllaso',
version='0.1.dev3',
author='<NAME>',
author_email='<EMAIL>',
description='The Scylla Stress Orchestrator is Python 3 based framework for running various '
'benchmark tools including cassandra-stre... | 1.242188 | 1 |
trainQ.py | aaronworry/two-arms-climb | 6 | 12766576 | from kinematicEnv import KinematicEnv
from QL import QL
from upDDPG import DDPG as uDDPG
import tensorflow as tf
from bottomDDPG import DDPG as bDDPG
import numpy as np
env = KinematicEnv()
s_dim = env.state_dim
a_dim = env.action_dim
a_bound = env.action_bound
g1 = tf.Graph()
isess1 = tf.Session(graph=g1)
with g1.as_... | 2.140625 | 2 |
internal/config.py | BhasherBEL/LDMv2 | 15 | 12766577 | <filename>internal/config.py
#!/usr/local/bin/python
# coding: utf-8
VERSION = '2.1.1'
# 0: CRITICAL, 1: INFO, 2: DEBUG
VERBOSE_LEVEL = 1
# 0: CONSOLE, 1: FILE, 2: CONSOLE & FILE
LOG_TYPE = 0
LOG_DIR = 'output'
HTML = False
DEBUG = True
| 1.421875 | 1 |
examples/cross.py | danzat/3dpp | 17 | 12766578 | from scene import *
from geometry import *
from observers import *
scene = Scene3D()
scene.line(Vector3(0, -1, 0), Vector3(0, 8, 0), style='->, dashed')
scene.line(Vector3(-2, 0, 0), Vector3(2, 0, 0), style='<->, dashed')
scene.line(Vector3(-2, 2, 0), Vector3(2, 2, 0), style='<->, dashed')
scene.line(Vector3(-2, 4, 0... | 2.546875 | 3 |
pyfastrand/pcg32.py | Mukundan314/python-fastrand | 2 | 12766579 | <filename>pyfastrand/pcg32.py
import os
__all__ = ['pcg32', 'pcg32bounded', 'pcg32inc', 'pcg32_seed']
state = int.from_bytes(os.urandom(8), 'big')
inc = 0xda3e39cb94b95bdb
def pcg32():
"""Generate a random (32 bit) integer using PCG."""
global state
xorshifted = (((state >> 18) ^ state) >> 27) & 0xffff... | 2.875 | 3 |
test/gym_wrappers_test.py | Data-Science-in-Mechanical-Engineering/edge | 0 | 12766580 | import unittest
import warnings
import numpy as np
# import safety_gym
# from safety_gym.envs.engine import Engine
import gym
import gym.spaces as spaces
from gym.envs.registration import register
from edge.gym_wrappers import BoxWrapper, DiscreteWrapper, GymEnvironmentWrapper
from edge.agent import RandomAgent
clas... | 2.265625 | 2 |
djvideomem/payment/views.py | mmg-3/dj-video-membership | 26 | 12766581 | from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.http import JsonResponse, HttpResponse
from django.views import generic
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import get_object_or_404, redirect, render
fr... | 2.046875 | 2 |
cellphonedb/src/api_endpoints/terminal_api/database_terminal_api_endpoints/database_terminal_commands.py | BioTuring-Notebooks/CellphoneDB | 35 | 12766582 | import os
from datetime import datetime
from typing import Optional
import click
from click import Context
from cellphonedb.src.api_endpoints.terminal_api.tools_terminal_api_endpoints.tools_terminal_commands import \
generate_proteins, generate_complex, _set_paths, generate_interactions, filter_all, generate_gene... | 2.125 | 2 |
OOP/classes.py | AndreiHustiuc/IT_Factory_Course | 0 | 12766583 | <filename>OOP/classes.py
class Human:
def __init__(self, name, age):
self.name = name
self.age = age
def greeting(self):
print(f"Hello {self.name}!")
def get_name(self):
return self.name
def get_age(self):
return self.age
def set_age(se... | 3.640625 | 4 |
ormar/decorators/__init__.py | paolodina/ormar | 0 | 12766584 | <filename>ormar/decorators/__init__.py
"""
Module with all decorators that are exposed for users.
Currently only:
* property_field - exposing @property like function as field in Model.dict()
* predefined signals decorators (pre/post + save/update/delete)
"""
from ormar.decorators.property_field import property_field... | 2.25 | 2 |
olive/scripts/calibration/__init__.py | liuyenting/olive-core | 0 | 12766585 | <filename>olive/scripts/calibration/__init__.py
from .aotf import *
| 1.1875 | 1 |
python/238_product_of_array_except_self.py | liaison/LeetCode | 17 | 12766586 |
class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
num_len = len(nums)
prefix_products, postfix_products = [1] * (num_len + 1), [1] * (num_len + 1)
prefix_product, postfix_product = 1, 1
for prefix_index in range(num_len):
prefix_product *= nu... | 3.03125 | 3 |
GestureDetection/GestureDetecttion.py | sainikhilgoud10/ComputerVision-ImageProcessing | 0 | 12766587 | import cv2
import numpy as np
import math
cap = cv2.VideoCapture(0)
while(cap.isOpened()):
ret, img = cap.read()
cv2.rectangle(img,(300,300),(100,100),(0,255,0),0)
crop_img = img[100:300,100:300]
grey = cv2.cvtColor(crop_img,cv2.COLOR_BGR2GRAY)
value = (35,35)
blurred = cv2.GaussianBlu... | 2.734375 | 3 |
src/zope/keyreference/testing.py | zopefoundation/zope.keyreference | 1 | 12766588 | <filename>src/zope/keyreference/testing.py<gh_stars>1-10
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A... | 2.03125 | 2 |
laser_escape/laser_escape.py | andrewzwicky/Laser-Escape | 0 | 12766589 | <gh_stars>0
#!/usr/bin/python
import csv
import datetime
import os
import time
from enum import Enum
import threading
import RPi.GPIO as GPIO
from Adafruit_CharLCD import Adafruit_CharLCDPlate
from getch import getch
from gpiozero import LightSensor
# Pins
from laser_beam_detection import laser_beam_penalties, LASER_... | 2.5 | 2 |
PK.py | pablovin/P-AffMem | 7 | 12766590 | """
Implementation of the model.
Parts of the code are inherited from the official CAAE implementation (https://arxiv.org/abs/1702.08423, https://github.com/ZZUTK/Face-Aging-CAAE).
"""
import os
import sys
import time
from glob import glob
import numpy as np
import tensorflow as tf
from scipy.io import loadmat, save... | 2.34375 | 2 |
common/messages.py | ne0h/battleship- | 0 | 12766591 | <reponame>ne0h/battleship-
CREATE_GAME = 'game_create'
JOIN_GAME = 'game_join'
LEAVE_GAME = 'game_abort'
SET_NICK = 'nickname_set'
INIT_BOARD = 'board_init'
FIRE = 'attack'
NUKE = 'special_attack'
MOVE = 'move'
SURRENDER = 'surrender'
CHAT_SEND = 'chat_send'
| 1.296875 | 1 |
fix_osm.py | MatheusMaciel/wrangle-openstreetmaps-data | 0 | 12766592 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module contains functions used to fix a osm file.
Attributes:
postcode_re (:re obj:): Regex compiler to USA postal codes.
"""
import xml.etree.cElementTree as ET # Use cElementTree or lxml if too slow
import pprint
import re
#postcode reg... | 3.109375 | 3 |
algo/src/stack.py | ssavinash1/Algorithm_stanford | 24 | 12766593 | # -*- coding: utf-8 -*-
class Stack(object):
""" Implements a simple stack data structure.
Attrs:
top: object, a pointer to the top object in the stack.
count: int, a counter of the number of elements in the stack.
"""
def __init__(self):
self.top = None
self.count = 0... | 4.125 | 4 |
code/21.py | nonword1/LiuBoss.LeetCode | 0 | 12766594 | <reponame>nonword1/LiuBoss.LeetCode
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
if not l1:
return l2
if not l2:
... | 3.796875 | 4 |
prac/ch1/nand_gate.py | soyeonjangg/deep-learning-from-scratch | 0 | 12766595 | <reponame>soyeonjangg/deep-learning-from-scratch<filename>prac/ch1/nand_gate.py<gh_stars>0
import numpy as np
def NAND(x1, x2):
x = np.array([x1, x2])
w = np.array(
[-0.5, -0.5]
) # the only diff between AND is that weight and bias are different
b = 0.7
tmp = np.sum(x, w) + b
if tmp <... | 3.0625 | 3 |
LeetCode/491 Increasing Subsequences.py | gesuwen/Algorithms | 0 | 12766596 | <gh_stars>0
# Depth-first Search
# Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing subsequence should be at least 2 .
#
# Example:
# Input: [4, 6, 7, 7]
# Output: [[4, 6], [4, 7], [4, 6, 7], [4, 6, 7, 7], [6, 7], [6, 7,... | 3.8125 | 4 |
examples/plot_sine_wave_2d.py | ktanishqk/py-earth | 360 | 12766597 | """
==================================
Plotting two simple sine functions
==================================
A simple example plotting a fit of two sine functions.
"""
import numpy
import matplotlib.pyplot as plt
from pyearth import Earth
# Create some fake data
numpy.random.seed(2)
m = 10000
n = 10
X = 80 * numpy.r... | 3.703125 | 4 |
pandera/external_config.py | matthiashuschle/pandera | 1 | 12766598 | <reponame>matthiashuschle/pandera<filename>pandera/external_config.py
"""Configuration for external packages."""
import os
try:
# try importing koalas to see if it exists. This is important because the
# pandera.typing module defines a Series type that inherits from
# pandas.Series, and koalas v1+ injects... | 2.03125 | 2 |
setup.py | walles/px | 149 | 12766599 | #!/usr/bin/env python
import os
import re
import shutil
import filecmp
import tempfile
import subprocess
from setuptools import setup
VERSIONFILE = "px/version.py"
git_version = (
subprocess.check_output(["git", "describe", "--dirty"]).decode("utf-8").strip()
)
with tempfile.NamedTemporaryFile(suffix=".py", del... | 1.84375 | 2 |
zproc/context.py | pycampers/zproc | 106 | 12766600 | import atexit
import multiprocessing
import pprint
import signal
import time
from contextlib import suppress
from typing import Callable, Union, Any, List, Mapping, Sequence, Tuple, cast
from . import util
from .consts import DEFAULT_NAMESPACE
from .process import Process
from .server import tools
from .state.state im... | 2.53125 | 3 |
HeadFirstPython/code/chapter3/setTest.py | BlossomRain/Read | 0 | 12766601 | <reponame>BlossomRain/Read<filename>HeadFirstPython/code/chapter3/setTest.py
odds = {1, 3, 5, 7}
evens = set([0, 2, 4, 6, 8])
print(odds.union(evens))
odds.intersection()
odds.difference() | 3.34375 | 3 |
mindsdb/interfaces/storage/db.py | yarenty/mindsdb | 0 | 12766602 | <filename>mindsdb/interfaces/storage/db.py
import os
import json
import datetime
import numpy as np
from sqlalchemy import create_engine, orm, types, UniqueConstraint
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, ... | 2.46875 | 2 |
chart_studio/presentation_objs/presentation_objs.py | piyush1301/plotly.py | 6 | 12766603 | <filename>chart_studio/presentation_objs/presentation_objs.py
"""
dashboard_objs
==========
A module for creating and manipulating spectacle-presentation dashboards.
"""
import copy
import random
import re
import string
import warnings
import _plotly_utils.exceptions
from chart_studio import exceptions
from chart_st... | 2.078125 | 2 |
AUTO-PLANNING/AutoTemplateTuning/projects/sequencing prediction/DataProcess.py | fishdda/RL-Application-in-TPS | 5 | 12766604 | <reponame>fishdda/RL-Application-in-TPS
class DATAPROCESS:
'''
Currently, this class is only specific to VMAT plans
'''
def __init__(self,RAW_DATA_PATH,NEW_DATA_PATH):
self.RAW_DATA_PATH = RAW_DATA_PATH
self.NEW_DATA_PATH = NEW_DATA_PATH
self.PLAN = {}
def TRANSFER_RAW_DAT... | 2.328125 | 2 |
demos/graphql/graph/chat/db_utils.py | hzlmn/aiohttp-demos | 649 | 12766605 | <gh_stars>100-1000
from aiopg.sa import SAConnection as SAConn
from aiopg.sa.result import RowProxy
from graph.types import RowsProxy
from graph.constants import OBJECT_NOT_FOUND_ERROR
from graph.chat.tables import (
rooms,
messages,
)
__all__ = [
'select_rooms',
'select_messages_by_room_id',
'se... | 2.359375 | 2 |
ggcg/gen/__init__.py | FreNeS1/ggcg | 1 | 12766606 | <filename>ggcg/gen/__init__.py
"""Generator package. Contains the logic to simplify, modify and regenerate new computational graphs based on existing
ones."""
| 1.257813 | 1 |
profiles/__init__.py | nivbend/memoir | 0 | 12766607 | from __future__ import unicode_literals
default_app_config = 'profiles.apps.ProfilesConfig'
| 1.164063 | 1 |
src/design.py | pbishnupuri/cse518-final-project | 0 | 12766608 | <filename>src/design.py<gh_stars>0
# Will probably split into multiple files and then have app.py put it all together
# QUESTION - Can we use ANNs??? Surely we should be able to right?
##### Graph
# Characteristics of the graph
# 1. Will be a complete graph
# 2. Nodes represent a person's political stance
... | 3.328125 | 3 |
hotsos/plugin_extensions/storage/bcache_summary.py | KellenRenshaw/hotsos | 6 | 12766609 | import re
from hotsos.core.host_helpers import CLIHelper
from hotsos.core.plugins.storage.bcache import BcacheChecksBase
class BcacheSummary(BcacheChecksBase):
def __summary_cachesets(self):
csets = self.get_sysfs_cachesets()
if csets:
return csets
def __summary_devices(self):
... | 2.046875 | 2 |
crawler/qq/qq/utils.py | markhuyong/galaxy | 0 | 12766610 | # -*- coding: utf-8 -*-
import random
import urllib
from scrapy.http.headers import Headers
from crawler.misc.spider import CommonSpider
from crawler.misc import agents
class BaseHelper(object):
PROFILE_URL = "https://mobile.qzone.qq.com/profile?hostuin=USER_QQ_NUMBER"
SHUOSHU_URL = "https://mobile.qzone.q... | 2.1875 | 2 |
order/admin.py | YatharthVats/Dishes-API | 0 | 12766611 | from django.contrib import admin
from .models import Dish
# Register your models here.
admin.site.register(Dish) | 1.328125 | 1 |
discordware/_vendors/__init__.py | znqi/discordware | 0 | 12766612 | import hype
__all__ = ["hype"]
| 1.054688 | 1 |
data/generate-agrawal-3.py | ingako/lifelong-ml | 2 | 12766613 | <gh_stars>1-10
#!/usr/bin/env python3
import sys
path = r'../'
if path not in sys.path:
sys.path.append(path)
from src.stream_generator import RecurrentDriftStream
max_samples = 400001
generator = 'agrawal'
for seed in range(0, 10):
stream = RecurrentDriftStream(generator=generator,
... | 2.5 | 2 |
{{cookiecutter.out_dir}}/src/{{cookiecutter.django_project_name}}/settings/test.py | SebCorbin/cookiecutter-django | 1 | 12766614 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import tempfile
from .base import * # noqa
for a in INSTALLED_APPS:
if 'rest_framework' in a:
REST_FRAMEWORK['TEST_REQUEST_DEFAULT_FORMAT'] = 'json'
SECRET_KEY = 'spam-spam-spam-spam'
MEDIA_ROOT = tempfile.mkdtemp()
FILE_UPLOAD_TEMP_DIR = tempfile.mkdtemp()
EMAIL... | 1.742188 | 2 |
networks.py | Blupblupblup/Deep-MSVDD-PyTorch | 0 | 12766615 | <gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
"""
architectures from:
- https://github.com/lukasruff/Deep-SAD-PyTorch/blob/master/src/networks/mnist_LeNet.py
- https://github.com/lukasruff/Deep-SAD-PyTorch/blob/master/src/networks/fmnist_LeNet.py
- https://github.com/lukasruff/Deep-SAD... | 2.890625 | 3 |
mocasin/mapper/test/test_gd.py | tud-ccc/mocasin | 1 | 12766616 | <reponame>tud-ccc/mocasin
# Copyright (C) 2020 TU Dresden
# Licensed under the ISC license (see LICENSE.txt)
#
# Authors: <NAME>, <NAME>
from mocasin.mapper.test.mock_cache import MockMappingCache
from mocasin.mapper.gradient_descent import GradientDescentMapper
import pytest
import numpy as np
from itertools import p... | 2.0625 | 2 |
algs/TRKNN/test.py | mbs8/ENaN | 1 | 12766617 | <filename>algs/TRKNN/test.py<gh_stars>1-10
import trknn
from sklearn import datasets
dataset = datasets.load_iris()
# dataset = datasets.load_breast_cancer()
# dataset = datasets.load_boston()
# dataset = datasets.load_diabetes()
# dataset = datasets.load_digits()
n = len(dataset.data)
subset = trknn.run(dataset.dat... | 2.484375 | 2 |
p1_basic/day32_35thread/day35/09_基于yield实现协程.py | dong-pro/fullStackPython | 1 | 12766618 | def f1():
print(11)
yield
print(22)
yield
print(33)
def f2():
print(55)
yield
print(66)
yield
print(77)
v1 = f1()
v2 = f2()
next(v1) # v1.send(None)
next(v2) # v1.send(None)
next(v1) # v1.send(None)
next(v2) # v1.send(None)
next(v1) # v1.send(None)
next(v2) # v1.send(N... | 2.8125 | 3 |
deploy/boto/lib/con.py | mmihira/rocket_wasm | 1 | 12766619 | <reponame>mmihira/rocket_wasm
import boto
import os
import json
import ConfigParser
import time
from boto.ec2.connection import EC2Connection
from boto.ec2.regioninfo import *
class Con:
def __init__(self):
self.proj_prefix = os.environ['PROJECT_PREFIX']
f = open(os.path.expanduser(os.environ["{}... | 2.453125 | 2 |
tareas/1/MontielJavier-RodriguezCarolina/profe_alumnos.py | ArchieMedes/sistop-2021-1 | 2 | 12766620 | #!/usr/bin/python3
'''
############################################################################
->Autores:
-<NAME>
-<NAME>
->Fecha de creación: 01/11/2020
->Descripción: Análisis y resolución del problema 'Los alumnos y el asesor'
############################################################################... | 3.46875 | 3 |
mtgcompiler/frontend/AST/statements.py | rmmilewi/mtgcompiler | 4 | 12766621 | import mtgcompiler.AST.core as core
from enum import Enum
class MgAbstractStatement(core.MgNode):
"""An ability is made of one or more statements, organized into an instruction sequence.
A statement encapsulates a subtree of expressions, usually terminated by a period."""
def __init__(self):
... | 2.8125 | 3 |
dltools/hooks.py | geodekid/frnn | 299 | 12766622 | """Defines hooks that can run during training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import lasagne
import numpy as np
from sklearn import metrics
class LoggingHook(object):
"""This hook writes information to a log file."""
def __ini... | 3.015625 | 3 |
updateDDBBservers.py | miguelFLG13/updateDDBBservers | 0 | 12766623 | <filename>updateDDBBservers.py<gh_stars>0
#! /usr/bin/python
"""
Script to upgrade ddbb in mysql servers
17/08/2015 by <NAME>
"""
import os
import sys
ddbb_servers = [] #Complete with MySQL servers
ddbb_users = [] #Complete with MySQL users
ddbb_passwords = [] #Complete with MySQL passwords
ddbb_names = [] #Complete... | 2.3125 | 2 |
sahara-10.0.0/sahara/plugins/edp.py | scottwedge/OpenStack-Stein | 161 | 12766624 | <gh_stars>100-1000
# Copyright (c) 2018 Red Hat, 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... | 1.5625 | 2 |
html_email/__init__.py | classroomtechtools/moodle_daily_notices | 0 | 12766625 | <filename>html_email/__init__.py
from html_email.Email import Email, read_in_templates
__all__ = [Email, read_in_templates]
| 1.46875 | 1 |
artistapp/artist/migrations/0009_remove_content_slug.py | fallprojects/ArtistApp | 0 | 12766626 | <gh_stars>0
# Generated by Django 3.1.3 on 2020-12-08 12:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('artist', '0008_auto_20201208_1136'),
]
operations = [
migrations.RemoveField(
model_name='content',
name='slug',... | 1.3125 | 1 |
Advanced/Generators/main.py | Alperencode/Python | 1 | 12766627 | <filename>Advanced/Generators/main.py
## Gerenators
def mygenerator(x):
for i in range(x):
yield i
values = mygenerator(100)
for i in values:
print(i)
print(next(mygenerator)) | 3.515625 | 4 |
flask-celery-example/app/celery/tasks.py | hk-badbuta/buta-exercise-celery | 0 | 12766628 | <reponame>hk-badbuta/buta-exercise-celery
from celery import task
@task(bind=True)
def hello(self):
# How to call me:
# At project folder:
# $ celery -A app.run_celery.celery call app.celery.tasks.hello
# app.run_celery.celery is the celery (actually is FlaskCelery) instance
# (from app.extensions... | 2.125 | 2 |
medium/1081-smallest-subsequence-of-distinct-characters.py | wanglongjiang/leetcode | 2 | 12766629 | <reponame>wanglongjiang/leetcode<gh_stars>1-10
'''
不同字符的最小子序列
返回 s 字典序最小的子序列,该子序列包含 s 的所有不同字符,且只包含一次。
注意:该题与 316 https://leetcode.com/problems/remove-duplicate-letters/ 相同
示例 1:
输入:s = "bcabc"
输出:"abc"
示例 2:
输入:s = "cbacdcbc"
输出:"acdb"
提示:
1 <= s.length <= 1000
s 由小写英文字母组成
'''
from collections import Counter... | 3.15625 | 3 |
utils/measure_inference_time.py | VakhrameevaLiza/pytorch_segmentation_framework | 0 | 12766630 | <filename>utils/measure_inference_time.py
import torch
import time
import numpy as np
from models.Unet import Unet
def measure_inference_time(model, input_size):
torch.backends.cudnn.benchmark = True
model.eval()
model = model.cuda()
input = torch.randn(*input_size).cuda()
# warming
for _ ... | 2.484375 | 2 |
cruw/mapping/ops.py | kanishkaisreal/cruw-devkit | 0 | 12766631 | <reponame>kanishkaisreal/cruw-devkit<filename>cruw/mapping/ops.py
import numpy as np
from cruw.mapping.coor_transform import pol2cart_ramap, cart2pol_ramap
def find_nearest(array, value):
"""Find nearest value to 'value' in 'array'."""
array = np.asarray(array)
idx = (np.abs(array - value)).argmin()
... | 2.34375 | 2 |
eval/utils/conf_file_utils.py | mbatchkarov/dc_evaluation | 0 | 12766632 | <filename>eval/utils/conf_file_utils.py
from os import path as path
import os
from pprint import pprint
import sys
from configobj import ConfigObj, flatten_errors
import validate
__author__ = 'mmb28'
def set_nested(dic, key_list, value):
"""
>>> d = {}
>>> nested_set(d, ['person', 'address', 'city'], 'Ne... | 2.921875 | 3 |
fib.py | DylanYoung/ComparingFibonacciAlgorithms | 0 | 12766633 | # Implementations done in Python since it natively supports unbounded integer
# arithmetic and fractional math
#Compiled with Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
#in IDLE version 2.7.3
#For profiling (written in C to avoid overhead)
import cProfile
# to deal with fract... | 3.640625 | 4 |
script/chinatimes.py | radjan/newspac | 2 | 12766634 | <reponame>radjan/newspac
from bs4 import BeautifulSoup
import urllib2
import re
import rss_base
class Handler(rss_base.RssBaseHandler):
def fetch_text(self, url):
try:
u = urllib2.urlopen(url)
url = u.geturl()
bs = BeautifulSoup(u)
canonical_url = self.get_ca... | 2.546875 | 3 |
flask_app.py | molliewhite/mission_to_mars | 0 | 12766635 | #Get dependencies
from flask import Flask, render_template, redirect
import pymongo
import mission_to_mars
import jinja2
from jinja2 import TemplateNotFound
#Create Flask App
app = Flask(__name__)
#Connect to MongoDB
conn = "mongodb://localhost:27017"
client = pymongo.MongoClient(conn)
db = client.mars_DB... | 2.5625 | 3 |
billing/urls.py | dbsiavichay/faclab | 0 | 12766636 | <gh_stars>0
from django.conf.urls import url
from django.urls import path
from .views import (
CustomerListView, CustomerCreateView, CustomerUpdateView,
TaxListView, TaxCreateView, TaxUpdateView, TaxDetailView,
InvoiceListView, InvoiceCreateView, InvoiceUpdateView, InvoiceInvoicedView, InvoicePaidView
)
urlpatterns... | 1.8125 | 2 |
xobox/cli/logger.py | gitter-badger/xobox | 0 | 12766637 | # -*- coding: utf-8 -*-
"""
xobox.cli.logger
~~~~~~~~~~~~~~~~
:copyright: Copyright 2017 by the Stormrose Project team, see AUTHORS.
:license: MIT License, see LICENSE for details.
"""
import sys
from datetime import datetime
from ..conf import get_conf
from ..utils.singleton import Singleton
from ..u... | 2.1875 | 2 |
paperpy/interfaces.py | paperpy/paperpy | 0 | 12766638 | <gh_stars>0
"""
This module contains all public interfaces that you can use to create plugins.
"""
import abc
class Action(abc.ABC):
"""
An action registers a subcommand in the paperpy command.
To register an action in your plugin add an ``paperpy.action`` entry point in the
setup::
... | 3.171875 | 3 |
blogApp/blog/views.py | yuniithings/yuniithings.com | 0 | 12766639 | <gh_stars>0
from blog.viewpackages.main import main_view
def index(request):
return main_view(request)
| 1.09375 | 1 |
redditclone/urls.py | jessejkwk/yup | 3 | 12766640 | <gh_stars>1-10
from django.conf.urls import url, include
from django.contrib import admin
from posts import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^accounts/', include('accounts.urls')),
url(r'^posts/', include('posts.urls')),
url(r'^$', views.HomeView.as_view(), name="home")
]
| 1.6875 | 2 |
interface_stability/scripts/phase_stability.py | adelaiden/interface_stability | 10 | 12766641 | <filename>interface_stability/scripts/phase_stability.py
import argparse
from pymatgen import Composition
from interface_stability.singlephase import VirtualEntry
def get_phase_equilibria_from_composition(args):
"""
Provides the phase equilibria of a phase with given composition
"""
comp = Composition... | 2.875 | 3 |
test_densecrf.py | lynetcha/densecrf-python | 13 | 12766642 | <reponame>lynetcha/densecrf-python
import cv2
import random
import numpy as np
from Pydensecrf import *
from pydensecrf.utils import unary_from_labels, create_pairwise_bilateral, create_pairwise_gaussian
def show_img(img):
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
def test_img_fw():... | 3 | 3 |
python/atmosEdit.py | vasaantk/bin | 0 | 12766643 | <reponame>vasaantk/bin<filename>python/atmosEdit.py
#! /usr/bin/env python
# <NAME>
import re
import sys
import random
userFiles = sys.argv[1:]
inpCount = len(userFiles)
userInp = 0
SPACES = " "
GAUSS_SIGMA = 5
printOrig = False
setUserGauss = False
setRandDZen = False
enterLoop = True
if userFiles == []:
e... | 2.84375 | 3 |
masci_tools/tools/greensfunction.py | soumyajyotih/masci-tools | 0 | 12766644 | # -*- coding: utf-8 -*-
###############################################################################
# Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. #
# All rights reserved. #
# This file is part of the Masci-tools package. ... | 2.109375 | 2 |
Logger.py | blake-edwards/Facial-Recognition | 0 | 12766645 | # logging times and names to a file for event parsing
import os
import time
from pathlib import Path
import csv
logPath = os.path.join(os.getcwd(), "face-log.txt")
FIELD_AMT = 2
class Logger(object):
# initialization function that creates the log file
def __init__(self):
path = Path(logPath)
if... | 3.296875 | 3 |
te/TE_CLASS.py | priyadarshitathagat/te-ns | 43 | 12766646 | #**********************************************************************************************
# Traffic Emulator for Network Services
# Copyright 2020 VMware, Inc
# The BSD-2 license (the "License") set forth below applies to all parts of
# the Traffic Emulator for Network Services project. You may not use this file
... | 0.945313 | 1 |
corehq/apps/userreports/tests/test_data_source_validaton.py | kkrampa/commcare-hq | 1 | 12766647 | <gh_stars>1-10
from __future__ import absolute_import, unicode_literals
from django.test import SimpleTestCase
from corehq.apps.userreports.exceptions import ValidationError
from corehq.apps.userreports.models import Validation
from corehq.apps.userreports.tests.utils import get_sample_data_source, get_sample_doc_and... | 2.25 | 2 |
examples/tensorboard/projector_demo.py | dwolfschlaeger/guildai | 694 | 12766648 | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 2.1875 | 2 |
bugbuzz_service/db/tables/files.py | fangpenlin/bugbuzz-api | 1 | 12766649 | <filename>bugbuzz_service/db/tables/files.py<gh_stars>1-10
from __future__ import unicode_literals
from sqlalchemy import Column
from sqlalchemy import Table
from sqlalchemy import Unicode
from sqlalchemy.dialects.postgresql import BYTEA
from sqlalchemy.schema import ForeignKey
from . import metadata
from . import no... | 2.046875 | 2 |
tests/test_gender.py | madduck/pytcnz | 0 | 12766650 | # -*- coding: utf-8 -*-
#
# Copyright © 2021–2022 <NAME> <<EMAIL>>
# Released under the MIT Licence
#
import pytest
from pytcnz.gender import Gender, InvalidGenderError
@pytest.fixture(
params=[
"M",
"W",
"Man",
"Men",
"Women",
"Woman",
"male",
"fe... | 2.703125 | 3 |