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 |
|---|---|---|---|---|---|---|
alchemy.py | temple-geography/gis-application-development | 3 | 12784551 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 15 22:12:27 2021
@author: tum98420
"""
#%%
###Connect to the database###
from sqlalchemy import create_engine
db = 'connection_string'
engine = create_engine(db)
#print table names
print(engine.table_names())
#establish connection to access and manipulate database
c... | 3.171875 | 3 |
fastfunc/divide.py | nschloe/fastfunc | 10 | 12784552 | <gh_stars>1-10
from _fastfunc import _divide_at
from .helpers import _operator_at
def at(a, k, vals):
_operator_at(_divide_at, a, k, vals)
return
| 1.460938 | 1 |
sdk/python/pulumi_vault/aws/secret_backend_role.py | pulumi/pulumi-vault | 10 | 12784553 | <gh_stars>1-10
# 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... | 1.664063 | 2 |
src/charma/streaming/decorators.py | mononobi/charma-server | 1 | 12784554 | # -*- coding: utf-8 -*-
"""
streaming decorators module.
"""
import charma.streaming.services as streaming_services
def stream(*args, **kwargs):
"""
decorator to register a stream provider.
:param object args: stream provider class constructor arguments.
:param object kwargs: stream provider class c... | 2.96875 | 3 |
hotdog/show_image.py | rparkin1/inceptionV3_hotdog | 0 | 12784555 | <gh_stars>0
#!/usr/bin/python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from IPython.display import Image, HTML, display
root = "images"
butions = dict(attributions)
def show_image(image_path):
display(Image(image_path))
... | 2.515625 | 3 |
lmsapi/api_netdevice/apps.py | orkasolutions-develop/lms-api-new | 0 | 12784556 | from django.apps import AppConfig
class ApiNetdeviceConfig(AppConfig):
name = 'api_netdevice'
| 1.109375 | 1 |
src/pyaxl/__init__.py | TeaObvious/pyaxl | 7 | 12784557 | from pyaxl.configuration import registry
from pyaxl.configuration import AXLClientSettings
| 1.171875 | 1 |
blog/models.py | bebutler1/SoloQ-DTC-Website-writtten-with-Django- | 0 | 12784558 | from django.db import models
# Create your models here. Database stuff
class Post(models.Model): #creates a table called posts
title = models.CharField(max_length=140) #Syntax: name = datatype(constraints)
body = models.TextField()
date = models.DateTimeField()
def __str__(self):
return sel... | 2.734375 | 3 |
sql/views.py | Galo1117/archer | 0 | 12784559 | <filename>sql/views.py
# -*- coding: UTF-8 -*-
import re, time
import simplejson as json
from threading import Thread
from collections import OrderedDict
from django.db.models import Q, F
from django.db import connection, transaction
from django.utils import timezone
from django.conf import settings
from django.shor... | 1.757813 | 2 |
graphene/types/tests/test_mutation.py | bcb/graphene | 0 | 12784560 | import pytest
from ..mutation import Mutation
from ..objecttype import ObjectType
from ..schema import Schema
from ..scalars import String
from ..dynamic import Dynamic
def test_generate_mutation_no_args():
class MyMutation(Mutation):
'''Documentation'''
@classmethod
def mutate(cls, *args... | 2.34375 | 2 |
planck_viewer.py | heyfaraday/CMB_test | 0 | 12784561 | import matplotlib.pyplot as plt
import numpy as np
import healpy as hp
map_I = hp.read_map('data/COM_CMB_IQU-smica_1024_R2.02_full.fits')
hp.mollview(map_I, norm='hist', min=-0.1, max=0.1, xsize=2000)
plt.show()
map_Q = hp.read_map('data/COM_CMB_IQU-smica_1024_R2.02_full.fits', field=1)
hp.mollview(map_Q, norm='hist... | 1.945313 | 2 |
src/std/rfc4566.py | ojimary/titus | 108 | 12784562 | <reponame>ojimary/titus<gh_stars>100-1000
# Copyright (c) 2007, <NAME>. All rights reserved. See LICENSING for details.
# @implements RFC4566 (SDP)
import socket, time
class attrs(object):
'''A generic class that allows uniformly accessing the attribute and items,
and returns None for invalid attribute... | 2.4375 | 2 |
python/visu_res.py | RTOS-Team-2/team2 | 1 | 12784563 | import os
import cv2
import random
import logging
from tkinter import Tk
from car import Car, CarSpecs
from HTCSPythonUtil import config
if os.name == "nt":
# https://github.com/opencv/opencv/issues/11360
import ctypes
# Set DPI Awareness (Windows 10 and 8)
_ = ctypes.windll.shcore.SetProcessDpiAwaren... | 2.546875 | 3 |
gmail/envio_email.py | guilalves/Automacao-Python | 0 | 12784564 | import emoji
from config import config_email
def enviar_email():
envio_email = emoji.emojize('E-mail enviado com sucesso! :wink:', use_aliases=True)
try:
config_email()
except Exception as e:
print(f'Erro ao chamar a funcao de disparo de emails! {e}')
else:
print(f'{envio_ema... | 2.921875 | 3 |
Labs/12_snake.py | bgoldstone/Computer_Science_I | 0 | 12784565 | <reponame>bgoldstone/Computer_Science_I
#################################
# 12_snake.py
#
# Name: <NAME>
# Date: 11/16/2001
#
# The classic arcade game "Snake"
#
#################################
import pygame
from random import randint
pygame.init()
# Constants:
WIDTH = 900
HEIGHT = 600
CENTER = (WIDTH//2, HEIGHT/... | 3.71875 | 4 |
omnirob/omnibot/nengo/omnibot_network_test.py | caxenie/neuromorphic-sensorimotor-adaptation | 0 | 12784566 | import show_omnibot
import numpy as np
import nengo
model = nengo.Network()
with model:
bot = show_omnibot.OmniBotNetwork(
show_omnibot.connection.Serial('/dev/ttyUSB2', baud=2000000),
motor=True, arm=True, retina=False, # freqs=[100, 200, 300],
wheel=True, servo=True, load=True, msg_peri... | 2.578125 | 3 |
src/my_project/easy_problems/from101to150/to_lower_case.py | ivan1016017/LeetCodeAlgorithmProblems | 0 | 12784567 | from typing import List
class Solution:
def toLowerCase(self, s: str) -> str:
answer: str = ""
x = ""
for letter in s:
if ord(letter) <= 90 and ord(letter) >= 65:
x = chr(ord(letter) + 32)
answer += x
else:
answer += l... | 3.5625 | 4 |
alipay/aop/api/response/AlipayFundTransAacollectBatchQueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 12784568 | <filename>alipay/aop/api/response/AlipayFundTransAacollectBatchQueryResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.BatchDetailInfo import BatchDetailInfo
from alipay.aop.api.domain.BatchDetailInfo import... | 1.789063 | 2 |
pytorch/train.py | renyiryry/natural-gradients | 1 | 12784569 | <filename>pytorch/train.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import numpy as np
import input_data
from sklearn.utils import shuffle
import warnings
warnings.filterwarnings('error')
from utils import *
import argparse
import sys
import time
import copy
np.random.s... | 2.671875 | 3 |
jaad/renderers.py | AmadeusITGroup/jaad | 0 | 12784570 | from rest_framework.renderers import JSONRenderer, BaseRenderer
from rest_framework_csv.renderers import CSVRenderer as BaseCSVRenderer
class TextRenderer(BaseRenderer):
media_type = "text/plain"
format = "text"
format_description = "text"
def render(self, data, *args, **kwargs):
if isinstanc... | 2.59375 | 3 |
graph_tools/data_gen.py | manon643/causal_lasso | 3 | 12784571 | import networkx as nx
import numpy as np
def gen_graph(graph_type, n, mean_deg):
"""Generates and returns a nx.Digraph and its adjacency matrix. Nodes are randomly permutated.
Arguments:
graph_type (string): type of graph Erdos-Renyi, scale-free, sachs or any graph in BNRepo
n (int): number o... | 3.25 | 3 |
asymmetric_cryptography/asymmetric.py | elishahyousaf/Awesome-Python-Scripts | 1,026 | 12784572 | from Crypto import Random
from Crypto.PublicKey import RSA
import base64
def generate_keys(modulus_length=256*4):
privatekey = RSA.generate(modulus_length, Random.new().read)
publickey = privatekey.publickey()
return privatekey, publickey
def encryptit(message , publickey):
encrypted_msg = publickey... | 3.09375 | 3 |
pyof/v0x04/controller2switch/set_async.py | smythtech/python-openflow-legacy | 0 | 12784573 | <filename>pyof/v0x04/controller2switch/set_async.py<gh_stars>0
"""Define SetAsync message.
Sets whether a controller should receive a given asynchronous message that is
generated by the switch.
"""
# System imports
# Third-party imports
# Local imports
from pyof.v0x04.common.header import Type
from pyof.v0x04.contr... | 2.5 | 2 |
14 Sound generation with VAE/code/train.py | aishifugi/generating-sound-with-neural-networks | 81 | 12784574 | <reponame>aishifugi/generating-sound-with-neural-networks
import os
import numpy as np
from autoencoder import VAE
LEARNING_RATE = 0.0005
BATCH_SIZE = 64
EPOCHS = 150
SPECTROGRAMS_PATH = "/home/valerio/datasets/fsdd/spectrograms/"
def load_fsdd(spectrograms_path):
x_train = []
for root, _, file_names in ... | 2.734375 | 3 |
py/strato/racktest/infra/handlekill.py | eyal-stratoscale/pyracktest | 0 | 12784575 | <filename>py/strato/racktest/infra/handlekill.py<gh_stars>0
import signal
import sys
import logging
def _informIntSignalCaughtAndExit(* args):
logging.info("Caught Ctrl-C, exiting from process")
sys.exit()
def _informTermSignalCaughtAndExit(* args):
logging.info("SIGTERM received, exiting from process")... | 1.695313 | 2 |
analyzer/commandline_wrapper.py | FlxB2/Constraint-Based-Automated-Updating-of-Application-Deployment-Models | 2 | 12784576 | <filename>analyzer/commandline_wrapper.py
import fileinput
import re
from output_reader import Output_Reader
from fast_downward_output_reader import Fast_Downward_Output_Reader
from jasper_output_reader import Jasper_Output_Reader
def parse_planner_output(output):
# split outputs by delimiter e.g. <<<<FD>>>> or <<<<J... | 2.921875 | 3 |
script/entrypoint.py | riedan/postgres | 0 | 12784577 | #!/usr/bin/python3
import os
import shutil
import sys
from entrypoint_helpers import env, gen_cfg, gen_container_id, str2bool, start_app, set_perms, set_ownership
RUN_USER = env['sys_user']
RUN_GROUP = env['sys_group']
PG_DATA = env['pgdata']
PG_CONFIG_DIR = env['pg_config_dir']
try:
PG_SSL_KEY_FILE = env['pg_s... | 1.960938 | 2 |
falconcv/models/__init__.py | haruiz/FalconCV | 16 | 12784578 | from .api_installer import ApiInstaller
from .model_builder import ModelBuilder
from .api_model import ApiModel
| 1.046875 | 1 |
maoyan/maoyan/spiders/weibo.py | hellending/-requests-selenium- | 0 | 12784579 | <filename>maoyan/maoyan/spiders/weibo.py
from selenium import webdriver
import time,re,requests,csv,os,socket
from lxml import etree
import os
import sys
from selenium.webdriver.remote.webelement import WebElement
socket.setdefaulttimeout(7)
os.environ['REQUESTS_CA_BUNDLE'] = os.path.join(os.path.dirname(sys.argv[0]... | 2.53125 | 3 |
lib/crypto/receipt.py | clouserw/zamboni | 0 | 12784580 | <filename>lib/crypto/receipt.py
import json
from django.conf import settings
from django_statsd.clients import statsd
import commonware.log
import jwt
import requests
log = commonware.log.getLogger('z.crypto')
class SigningError(Exception):
pass
def sign(receipt):
"""
Send the receipt to the signing... | 2.21875 | 2 |
theano_utils.py | Alexzhuqch001/temprnn | 0 | 12784581 | <reponame>Alexzhuqch001/temprnn<filename>theano_utils.py
# Copyright (c) 2016, NVIDIA Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code m... | 1.460938 | 1 |
src/tweet.py | fesanlu/Datos-COVID19 | 2 | 12784582 | import sys
import tweepy
def tweeting(consumer_key, consumer_secret, my_access_token, my_access_token_secret, message):
# Authentication
my_auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
my_auth.set_access_token(my_access_token, my_access_token_secret)
my_api = tweepy.API(my_auth)
my_... | 2.875 | 3 |
days/day101/Bite 92. Humanize a datetime/test_humanize_date.py | alex-vegan/100daysofcode-with-python-course | 2 | 12784583 | <filename>days/day101/Bite 92. Humanize a datetime/test_humanize_date.py
from datetime import timedelta
import pytest
from humanize_date import pretty_date, NOW
def n_days_ago_str(days):
return (NOW - timedelta(days=days)).strftime('%m/%d/%y')
@pytest.mark.parametrize("arg, expected", [
(NOW -... | 3 | 3 |
src/raritan/rpc/cert/__init__.py | vhirtzel/apc_reboot | 1 | 12784584 | <filename>src/raritan/rpc/cert/__init__.py
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.
#
# Section generated by IdlC from "ServerSSLCert.idl"
#
import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration... | 1.945313 | 2 |
naampy/in_rolls_fn.py | appeler/naampy | 4 | 12784585 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import argparse
import pandas as pd
from pkg_resources import resource_filename
from .utils import column_exists, fixup_columns, get_app_file_path, download_file
IN_ROLLS_DATA = {'v1': 'https://dataverse.harvard.edu/api/v1/access/datafile/4967581',... | 2.96875 | 3 |
itez/users/urls.py | Digital-Prophets/itez | 1 | 12784586 | from django.urls import path
from itez.users.views import (
update_view,
# UserUpdateView,
user_delete,
user_detail_view,
user_redirect_view,
UserCreateView,
user_profile,
user_profile_photo_update,
)
app_name = "users"
urlpatterns = [
path("user/create/", UserCreateView.as_view(),... | 2.078125 | 2 |
fltk/nets/fashion_mnist_cnn.py | AbeleMM/fltk-testbed | 0 | 12784587 | <reponame>AbeleMM/fltk-testbed
# pylint: disable=missing-function-docstring,missing-class-docstring,invalid-name
import torch
class FashionMNISTCNN(torch.nn.Module):
def __init__(self):
super(FashionMNISTCNN, self).__init__()
self.layer1 = torch.nn.Sequential(
torch.nn.Conv2d(1, 16, k... | 2.359375 | 2 |
tensorflow_developer2/13_loading_preprocessing_data/homl_chap13_00_data_processing.py | swilliams11/machine-learning | 0 | 12784588 | <reponame>swilliams11/machine-learning<filename>tensorflow_developer2/13_loading_preprocessing_data/homl_chap13_00_data_processing.py<gh_stars>0
import tensorflow as tf
"""
This is chapter 13 of hands on machine learning revision 2.
Data processing
"""
"""Creating and modifying a dataset"""
def dataset_from_tensor_sl... | 3.359375 | 3 |
loops/digits.py | fa-alvarez/python-examples | 0 | 12784589 | #!/usr/bin/env python3
def digits(n):
"""The digits function returns how many digits a number has."""
count = 0
if n == 0:
return 1
while (n >= 1):
count += 1
n = n / 10
return count
print(digits(25)) # Should print 2
print(digits(144)) # Should print 3
print(digits(1000)) # Should print 4
print(digits... | 4.0625 | 4 |
Palindrome.py | shakirmahmood/Tasks | 0 | 12784590 | <gh_stars>0
#q = int(input("Enter number of queries: "))
s = input("Enter a string: ")
if s == s[::-1]:
print("Entered string is a palindrome.")
else:
# dL = list(s) #Dummy List
for i in range(len(s)):
x = s[i]
s = s[:i]+s[i+1:]
#print(s)
if s == s[::-1]:
... | 3.53125 | 4 |
stash.py | okahilak/xcoord | 0 | 12784591 | <reponame>okahilak/xcoord
# Note: Numba target needs to be set here and cannot be set after importing the library
NUMBA_TARGET = "parallel" # Available targets: "cpu", "parallel", and "cuda"
@nb.jit(nopython=True, parallel=True)
def example_func(a, b):
return a**2 + b**2
@nb.jit(nopython=True, parallel=True)
de... | 2.25 | 2 |
src/decorators/overrides.py | ZelphirKaltstahl/QuestionsAndAnswers | 0 | 12784592 | <filename>src/decorators/overrides.py
def overrides(interface_class):
def overrider(method):
assert(method.__name__ in dir(interface_class))
return method
return overrider | 2.53125 | 3 |
src/Shared/GMAO_Shared/GMAO_pyobs3/pyobs3/naaps.py | GEOS-ESM/AeroApps | 2 | 12784593 | #!/bin/env python
"""
Implements Python interface to NRL NAAPS files
"""
import os
import sys
from types import *
from pyhdf import SD
from glob import glob
from numpy import ones, concatenate, array,linspace,arange, transpose
from datetime import date, datetime, timedelta
from .config import strTem... | 2.46875 | 2 |
setup.py | themantalope/spongemock | 11 | 12784594 | <filename>setup.py
import setuptools
from distutils.core import setup
from os import path
# Helper functions
# ----------------
def readFile(file):
with open(file) as f:
return f.read()
# Arguments
# ------------
CLASSIFIERS = []
# Dynamic info
# ------------
VERSION = '0.3.4'
CLASSIFIERS += [
'Develop... | 1.960938 | 2 |
leetcode/24.swap-nodes-in-pairs.py | schio/algorithm_test | 0 | 12784595 | #
# @lc app=leetcode id=24 lang=python3
#
# [24] Swap Nodes in Pairs
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
if ... | 3.609375 | 4 |
wrappers/arlexecute/calibration/__init__.py | ska-telescope/algorithm-reference-library | 22 | 12784596 |
__all__ = ['calibration', 'calibration_control', 'iterators', 'operations', 'pointing', 'rcal'] | 1.09375 | 1 |
601-700/681-690/684-redundantConnection/redundantConnection.py | xuychen/Leetcode | 0 | 12784597 | class UnionFind(object):
def __init__(self):
self.table = {}
def union(self, x, y):
self.table[self.find(x)] = self.find(y)
def find(self, x):
self.table.setdefault(x, x)
return x if self.table[x] == x else self.find(self.table[x])
class Solution(object):
def findRedun... | 3.4375 | 3 |
Beginner/URI_1962.py | rbshadow/Python_URI | 3 | 12784598 | <reponame>rbshadow/Python_URI
def math():
test_case = int(input())
for i in range(test_case):
i_put = int(input())
if i_put == 2015:
print('1 A.C.')
else:
if i_put > 2015:
print((i_put - 2015) + 1, 'A.C.')
elif i_put < 2015:
... | 3.5 | 4 |
colight-master/run_batch.py | utkachenko/Con-MATSCo | 1 | 12784599 | import runexp
import testexp
import summary
memo = "multi_phase/sumo/pipeline"
runexp.main(memo)
print("****************************** runexp ends (generate, train, test)!! ******************************")
summary.main(memo)
print("****************************** summary_detail ends ******************************") | 1.539063 | 2 |
examples/NeuroML/FN.py | 29riyasaxena/MDF | 12 | 12784600 | from neuromllite import (
Network,
Cell,
Population,
Synapse,
RectangularRegion,
RandomLayout,
)
from neuromllite import (
Projection,
RandomConnectivity,
OneToOneConnector,
Simulation,
InputSource,
Input,
)
from neuromllite.NetworkGenerator import check_to_generate_or_r... | 2.6875 | 3 |
spotify-lyrics.py | justinqle/spotify-lyrics | 0 | 12784601 | <filename>spotify-lyrics.py
#!/usr/bin/env python3.7
import os
import subprocess
import sys
import spotipy
import spotipy.util as util
import lyricsgenius
scope = 'user-read-currently-playing'
username = os.getenv('SPOTIFY_USERNAME') # environment variable specifying Spotify username
if username is None:
print("... | 2.984375 | 3 |
deploy/httpd/dump.py | vmlaker/wabbit | 2 | 12784602 | """
Dump Apache HTTPD configuration to stdout.
"""
from os import chdir
from os.path import dirname, join, normpath, realpath
import sys
import coils
www_directory = sys.argv[1]
config_fname = sys.argv[2] if len(sys.argv)>=3 else 'wabbit.conf'
# Load the configuration, and add to it path to www.
config = coils.Conf... | 2.96875 | 3 |
test/test_generator.py | jrimyak/CSE-5525-Semantic-Parsing | 0 | 12784603 | <filename>test/test_generator.py
# coding: utf-8
import os
import unittest
from gpsr_command_understanding.generation import generate_sentence_parse_pairs
from gpsr_command_understanding.generator import Generator
from gpsr_command_understanding.grammar import NonTerminal, tree_printer, expand_shorthand
from gpsr_comm... | 2.75 | 3 |
src/titanic.py | santoshilam/titanic_reproducibility | 0 | 12784604 | <reponame>santoshilam/titanic_reproducibility
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 27 09:03:52 2020
@author: santo
"""
# linear algebra
import numpy as np
# data processing
import pandas as pd
# data visualization
import seaborn as sns
"""%matplotlib inline"""
from matplotlib import pyplot as plt
from ... | 2.5625 | 3 |
afs/orm/__init__.py | chanke/afspy | 0 | 12784605 | <filename>afs/orm/__init__.py
"""
module dealing with the object-realational mapping
"""
__all__ = ["DBMapper", ]
from afs.orm import DBMapper
from afs.orm import Historic
def setup_options():
"""
add logging options to cmd-line,
but surpress them, so that they don't clobber up the help-messages
""... | 2.40625 | 2 |
server/scry.py | Shuzhengz/Scry | 0 | 12784606 | from fastapi import FastAPI
from fastapi.responses import JSONResponse
from database import Database
app = FastAPI()
database = Database()
@app.get("/")
def read_root():
return {
"Collections": ["ports", "ssh_logins", "user_connections", "network_traffic", "storage"]
}
@app.get("/collection/{colle... | 2.859375 | 3 |
galois_field/GFp.py | syakoo/galois-field | 8 | 12784607 | from __future__ import annotations
from .core.ElementInGFp import ElementInGFp
from .core import validator, primitive_roots
class GFp:
"""Galois Field: GF(p)
Args:
p (int): A prime number.
Examples:
>>> from galois_field import GFp
In this case, p = 11.
>>> gf = GFp(11)... | 3.296875 | 3 |
models.py | linda-huang/SEAL_OGB | 0 | 12784608 | <reponame>linda-huang/SEAL_OGB
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import numpy as np
import torch
from torch.nn import (ModuleList, Linear, Conv1d, MaxPool1d, Embeddin... | 2.734375 | 3 |
tools/evaluate.py | anonymous202201/fast_transferable_blackbox_attack | 0 | 12784609 | """ Script for evaluating AE examples.
"""
import argparse
import importlib
import os
import shutil
import sys
import torch
import torchvision
from tqdm import tqdm
from fta.utils.dataset_utils import imagenet_utils
from fta.utils.torch_utils import image_utils, model_utils
import pdb
# Sample Us... | 2.421875 | 2 |
PoliBot/plugins/guilds/data.py | PoliticalHangouts/PoliticalHangout | 0 | 12784610 | <reponame>PoliticalHangouts/PoliticalHangout<gh_stars>0
import typing
import discord
from replit import db
class Colour:
def __init__(
self,
hex: int
) -> None:
self.hex=hex
class Guild:
def __init__(
self,
colour: Colour,
name: str
) -> None:
self.colour=colour.hex
self.name=n... | 2.890625 | 3 |
sknano/setup.py | haidi-ustc/scikit-nano | 21 | 12784611 | #!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from __future__ import unicode_literals
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('sknano', parent_package, top_path)
config.add_subp... | 1.953125 | 2 |
data_processing/CSV_Filtration.py | BrigitaPetk/support_department_dashboard | 0 | 12784612 | import pandas as pd
import datetime
from pathlib import Path
import numpy as np
def plus3h(data):
columns = ['Created','First Lock', 'FirstResponse', 'Close Time']
columns_to_3 = {column: f"{column}+3" for column in columns}
for col in columns:
for index, row in data.iterrows():
row = s... | 3.0625 | 3 |
tourney/achievements/reporter_achievement.py | netromdk/tourney | 1 | 12784613 | from .tiered_achievement import TieredAchievement
from .behavior import REPORT_SCORE_BEHAVIOR
class ReporterAchievement(TieredAchievement):
def __init__(self):
tiers = (
(1, "Reporter", "Reported a score."),
(10, "Journalist", "Reported 10 scores."),
(25, "Correspondent... | 2.59375 | 3 |
appviews/test.py | johnderm/remote | 0 | 12784614 | <gh_stars>0
dict = {'1':2, '2':3}
print(dict['1']) | 2.578125 | 3 |
algorithm/impl/iterable/__init__.py | alpavlenko/EvoGuess | 1 | 12784615 | from .tabu_search import TabuSearch
algorithms = {
TabuSearch.slug: TabuSearch,
}
__all__ = [
'TabuSearch',
]
| 1.304688 | 1 |
test/conftest.py | roeeiit1/sqlalchemy-prometheus | 8 | 12784616 | import os
import pytest
@pytest.fixture(scope="session")
def settings():
return {
"HOST": "solr",
"PORT": 8983,
"PROTO": "http://",
"SOLR_USER": os.environ["SOLR_USER"],
"SOLR_PASS": os.environ["SOLR_PASS"],
"SERVER_PATH": "solr",
"SOLR_BASE_URL": "http://s... | 1.835938 | 2 |
choice/companion/recruit.py | xelrach/DASaveReader | 1 | 12784617 | <reponame>xelrach/DASaveReader<gh_stars>1-10
# Copyright 2014 <NAME>
#
# 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 a... | 1.773438 | 2 |
ktane/modules/mazes.py | mattvperry/ktane-py | 0 | 12784618 | <gh_stars>0
from ktane import Module
from itertools import chain
from .maze_data import maze_data
class Mazes(Module):
def run(self):
mazes = map(Maze, maze_data)
identifier_coords = self.get_coord_or_quit('identifier')
if identifier_coords is None: return
mazes = [x for x in maz... | 3.171875 | 3 |
airflow/providers/trino/transfers/gcs_to_trino.py | npodewitz/airflow | 8,092 | 12784619 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1.914063 | 2 |
tresonator/transmission_line_utils.py | jhillairet/tresonator | 0 | 12784620 | # -*- coding: utf-8 -*-
"""
Transmission Line helper functions
"""
import numpy as np
def ZL_2_Zin(L,Z0,gamma,ZL):
"""
Returns the input impedance seen through a lossy transmission line of
characteristic impedance Z0 and complex wavenumber gamma=alpha+j*beta
Zin = ZL_2_Zin(L,Z0,gamma,ZL)
... | 3.25 | 3 |
utils/chip-form.py | SarahFDAK/FairbanksDistributors | 1 | 12784621 | import json
def main():
with open('chips.csv', 'r') as f:
data = f.read()
raw_types = [
t.split('\n') for t in data.split('$$TYPE$$') if t != '\n'
]
items = []
for t in raw_types:
type_name = t[0].strip()
print(type_name)
raw_items = [item.split('\t') for... | 2.78125 | 3 |
pycompupipe/components/gui/gui_manager.py | xaedes/PyCompuPipe | 1 | 12784622 | <gh_stars>1-10
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division # Standardmäßig float division - Ganzzahldivision kann man explizit mit '//' durchführen
from __future__ import absolute_import
import numpy as np
from pyecs import *
from . import GuiElement
from funcy import partial
c... | 2.21875 | 2 |
py/grader_test1.py | tkuboi/gradzilla | 0 | 12784623 | import unittest
from lab1 import get_max
from lab1 import reverse
from lab1 import search
from lab1 import fib
from lab1 import factorial_iter
from lab1 import factorial_rec
class MyTest(unittest.TestCase):
def runTest(self):
with self.subTest(msg="testing get_max"):
self.test_get_max()
... | 3.375 | 3 |
gtsfm/two_view_estimator.py | swershrimpy/gtsfm | 122 | 12784624 | <reponame>swershrimpy/gtsfm
"""Estimator which operates on a pair of images to compute relative pose and verified indices.
Authors: <NAME>, <NAME>
"""
import logging
from typing import Dict, Optional, Tuple
import dask
import numpy as np
from dask.delayed import Delayed
from gtsam import Cal3Bundler, Pose3, Rot3, Uni... | 2.15625 | 2 |
flask_kits/utils/util.py | by46/flask-kits | 1 | 12784625 | <filename>flask_kits/utils/util.py
import time
from decimal import Decimal
__all__ = ['purge_sum_result', 'timestamp', 'get_raw_path']
def purge_sum_result(result, field_name='amount', default=None):
key = '{0}__sum'.format(field_name)
if default is None:
default = Decimal('0')
return... | 2.265625 | 2 |
untitled/VectorialIndex/VectorialIndex.py | Miky91/Python | 0 | 12784626 | # Insertar aqui la cabecera
import string
# Dada una linea de texto, devuelve una lista de palabras no vacias
# convirtiendo a minusculas y eliminando signos de puntuacion por los extremos
# Ejemplo:
# > extrae_palabras("Hi! What is your name? John.")
# ['hi', 'what', 'is', 'your', 'name', 'john']
def extrae_pala... | 3.734375 | 4 |
ecosystem_tests/ecosystem_tests_cli/plugins.py | cloudify-incubator/cloudify-ecosystem-test | 1 | 12784627 | <gh_stars>1-10
########
# Copyright (c) 2014-2021 Cloudify Platform Ltd. 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.3125 | 2 |
exercicios/ex18ERRADO.py | gabrielaraujo3/exercicios-python | 0 | 12784628 | <filename>exercicios/ex18ERRADO.py
import math
n1 = float(input('Digite um angulo: '))
sn = math.sin(n1)
co = math.cos(n1)
ta = math.tan(n1)
print('Seno {}, cosseno {} e a tangente {} de {}'.format(sn,co,ta,n1))
ERRADO | 3.890625 | 4 |
Chapter03/2data_normalization.py | packtprasadr/Machine-Learning-Algorithms | 78 | 12784629 | from __future__ import print_function
import numpy as np
from sklearn.preprocessing import Normalizer
# For reproducibility
np.random.seed(1000)
if __name__ == '__main__':
# Create a dummy dataset
data = np.array([1.0, 2.0])
print(data)
# Max normalization
n_max = Normalizer(norm... | 3.3125 | 3 |
Partial_correlation.py | rmccole/UCEs_genome_organization | 3 | 12784630 | """
Script to take matrices and calculate partial correlations using matlab functions called using the matlab engine for
python.
Distributed under the following license:
Copyright 2017 Harvard University, Wu Lab
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in comp... | 3 | 3 |
TFQ/VQE/vqe_multi.py | Project-Fare/quantum_computation | 27 | 12784631 | <filename>TFQ/VQE/vqe_multi.py
import tensorflow as tf
import tensorflow_quantum as tfq
import cirq
import sympy
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
def f(x):
vqe.set_weights(np.array([x]))
ret = vqe(tfq.convert_to_tensor([cirq.Circuit()]))
retu... | 2.171875 | 2 |
weather/api/migrations/0001_initial.py | Ethan-Genser/Weather-Station | 0 | 12784632 | # Generated by Django 2.1.5 on 2019-01-22 20:47
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Humidity',
fields=[
('id', models.AutoField... | 1.898438 | 2 |
apps/classroom/forms.py | alfarhanzahedi/edumate | 1 | 12784633 | <gh_stars>1-10
from django import forms
from .models import Classroom
from .models import Post
from .models import Comment
class ClassroomCreationForm(forms.ModelForm):
class Meta:
model = Classroom
fields = ('title', 'description', )
help_texts = {
'title': 'A suitable title ... | 2.5625 | 3 |
kloppy_spark/sinks/__init__.py | deepsports-io/kloppy-spark | 0 | 12784634 | from .show_dataframe import ShowDataFrame
| 1.140625 | 1 |
fungsi_korelasi/korelasi_gas.py | khairulh/pvt-calculator-fr | 0 | 12784635 | <gh_stars>0
from math import e as e_nat
from math import log as ln
from math import log10, ceil, floor
def array_P(P_atm, step, P_res, Pb):
"""
Array 1D dari tekanan untuk standardisasi (psia)
:param start: Biasanya 14.7 psia
:param step: Biasanya 1 psia
:param stop: Biasanya P reservoir (... | 2.703125 | 3 |
bin/secret_parser.py | fasrc/hubzero-docker | 0 | 12784636 | import os
import configparser
| 1.101563 | 1 |
accounts/migrations/0002_auto_20210630_0652.py | Srinjay-hack/Buddy | 0 | 12784637 | # Generated by Django 3.2.4 on 2021-06-30 06:52
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='assistant',
... | 1.789063 | 2 |
nablapps/poll/admin.py | pettaroni/nablaweb | 0 | 12784638 | <reponame>pettaroni/nablaweb<gh_stars>0
"""
Admin interface for poll app.
"""
from django.contrib import admin
from .models import Poll, Choice
class ChoiceInline(admin.TabularInline):
"""Define how the choices should be viewed inlined with the poll"""
model = Choice
extra = 5
fields = ('choice', 'vot... | 2.453125 | 2 |
src/python/coref/train/pw/run/train_bin.py | nmonath/coref_tools | 0 | 12784639 | """
Copyright (C) 2018 University of Massachusetts Amherst.
This file is part of "coref_tools"
http://github.com/nmonath/coref_tools
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.... | 1.765625 | 2 |
test1.py | walkeb6/tf-test1 | 0 | 12784640 | <reponame>walkeb6/tf-test1
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
# input and target output
x1 = tf.placeholder(tf.float32,shape=[None,784])
x2 = tf.placeholder(tf.float32,shape=[None,784])
x= ... | 3.046875 | 3 |
server/app.py | johnjdailey/JS-Realtime-Dashboard | 1 | 12784641 | from flask import Flask
# blueprint import
from blueprints.tweets.tweets import tweetsData
from blueprints.btc.btc import btcData
def create_app(app):
# register blueprint
app.register_blueprint(tweetsData)
app.register_blueprint(btcData)
return app
if __name__ == "__main__":
app = Flask(__nam... | 2.203125 | 2 |
app/interfaces/i_parser.py | heatonk/caldera_pathfinder | 71 | 12784642 | import abc
class ParserInterface(abc.ABC):
@abc.abstractmethod
def parse(self, report):
pass
| 2.421875 | 2 |
Algorithm/FizzBuzz.py | ChawisB/KuberOpsTest | 0 | 12784643 | <reponame>ChawisB/KuberOpsTest
#Initially tried switch case but didn't really work out so tried f strings instead
def fizzbuzz(n):
for i in range(1, n + 1):
print([f'{i}', f'Fizz', f'Buzz', f'FizzBuzz'][(i % 3 == 0) + 2 * (i % 5 == 0)])
fizzbuzz(100)
| 2.71875 | 3 |
filters/tests/test_mixins.py | jof/drf-url-filters | 176 | 12784644 | <filename>filters/tests/test_mixins.py
import unittest
from filters.mixins import FiltersMixin
class MyTest(unittest.TestCase):
def test(self):
self.assertEqual(4, 4)
| 2.171875 | 2 |
youtube/views.py | BudzynskiMaciej/Django-Project | 0 | 12784645 | from django.shortcuts import render
from django.views import View
from django.views.generic import ListView, DetailView
from .models import Video
from django.contrib.auth.mixins import LoginRequiredMixin
# Create your views here.
class PopularVideosList(ListView):
template_name = 'index.html'
context_object... | 2.109375 | 2 |
django_prices_vatlayer/migrations/0002_ratetypes.py | korycins/django-prices-vatlayer | 12 | 12784646 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-25 13:40
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('django_prices_vatlayer', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | 1.960938 | 2 |
icontact/observer.py | rochapps/django-icontact | 1 | 12784647 | """
Observer for iContact instances
"""
import logging
from django.db.models import signals
from icontact.models import IContact
from icontact.client import IContactClient, IContactException
logger = logging.getLogger(__name__)
class IContactObserver(object):
"""
Class that utilizes icontact client to ... | 2.59375 | 3 |
pytorch/config.py | maystroh/modelgenesis | 0 | 12784648 | import os
import shutil
import logging
logging.basicConfig(
format='%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
level=logging.DEBUG)
log = logging.getLogger()
class models_genesis_config:
model = "Unet3D"
suffix = "genesis_oct"
exp_name = ... | 2.09375 | 2 |
app/control/serializers.py | aalquaiti/challenge | 0 | 12784649 | <gh_stars>0
# Created by: <NAME>
# For QCTRL Backend Challenge
# January 2020
"""
Contains all Serializers used by Models in app
"""
from rest_framework import serializers
from .models import Control
class ControlSerializer(serializers.ModelSerializer):
"""
Serializer for Control Model. All fields are requir... | 1.78125 | 2 |
app/api/v1/schema/ussd.py | a-wakeel/Device-Registration-Subsystem | 6 | 12784650 | <filename>app/api/v1/schema/ussd.py<gh_stars>1-10
"""
DRS Registration schema package.
Copyright (c) 2018-2020 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided tha... | 1.140625 | 1 |