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 |
|---|---|---|---|---|---|---|
CareerTinderServer/CareerTinder/migrations/0002_auto_20160918_0011.py | sarojaerabelli/HVGS | 1 | 22000 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-18 04:11
from __future__ import unicode_literals
import CareerTinder.listfield
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('CareerTinder', '0001_initial'),
]
operations = [
... | 1.9375 | 2 |
tests/test_client.py | nyush-se-spring2021-forum/OurTieba | 0 | 22001 | <gh_stars>0
class TestClient:
"""
Test before_request and after_request decorators in __init__.py.
"""
def test_1(self, client): # disallowed methods
res = client.put("/")
assert res.status_code == 405
assert b"Method Not Allowed" in res.content
res = client.options("/... | 2.796875 | 3 |
cadence/activity_loop.py | mfateev/cadence-python | 0 | 22002 | import datetime
import logging
import json
from cadence.activity import ActivityContext
from cadence.cadence_types import PollForActivityTaskRequest, TaskListMetadata, TaskList, PollForActivityTaskResponse, \
RespondActivityTaskCompletedRequest, RespondActivityTaskFailedRequest
from cadence.conversions import json... | 2.265625 | 2 |
support/fetch_validators_load.py | sonofmom/ton-zabbix-scripts | 0 | 22003 | <reponame>sonofmom/ton-zabbix-scripts
#!/usr/bin/env python3
#
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import argparse
import datetime
import time
import requests
import Libraries.arguments as ar
import Classes.AppConfig as AppConfig
import Classes.LiteClient... | 2.078125 | 2 |
packnet_sfm/loggers/wandb_logger.py | asmith9455/packnet-sfm | 982 | 22004 | # Copyright 2020 Toyota Research Institute. All rights reserved.
# Adapted from Pytorch-Lightning
# https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/loggers/wandb.py
from argparse import Namespace
from collections import OrderedDict
import numpy as np
import torch.nn as nn
import w... | 2.265625 | 2 |
source_code/trans.py | shinyfe74/EN_KOR_translator | 0 | 22005 | <reponame>shinyfe74/EN_KOR_translator
from tkinter import *
from tkinter import ttk
import numpy as np
from PIL import ImageGrab
from PIL import Image
from pytesseract import *
import re
import cv2
from googletrans import Translator as google_translator
from pypapago import Translator as papago_translator
from kakaotra... | 2.9375 | 3 |
src/data/data_processing.py | ChrisPedder/Medieval_Manuscripts | 0 | 22006 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 3 17:20:06 2018
@author: chrispedder
A routine to crop sections from the images of different manuscripts in the two
datasets to the same size, and with the same magnification, so that the average
script size doesn't create a feature that the neura... | 2.96875 | 3 |
ivy/container/gradients.py | Aarsh2001/ivy | 0 | 22007 | from typing import Optional, Union, List, Dict
# local
import ivy
from ivy.container.base import ContainerBase
# noinspection PyMissingConstructor
class ContainerWithGradients(ContainerBase):
@staticmethod
def static_optimizer_update(
w,
effective_grad,
lr,
inplace=None,
... | 2.328125 | 2 |
desktop/core/ext-py/Mako-1.0.7/test/test_cmd.py | kokosing/hue | 5,079 | 22008 | from __future__ import with_statement
from contextlib import contextmanager
from test import TemplateTest, eq_, raises, template_base, mock
import os
from mako.cmd import cmdline
class CmdTest(TemplateTest):
@contextmanager
def _capture_output_fixture(self, stream="stdout"):
with mock.patch("sys.%s" % ... | 2.359375 | 2 |
corefacility/core/models/module.py | serik1987/corefacility | 0 | 22009 | <reponame>serik1987/corefacility<filename>corefacility/core/models/module.py
import uuid
from django.db import models
class Module(models.Model):
"""
Defines the information related to the application module that is stored to the
database, not as a Django application
"""
uuid = models.UUIDField(db... | 2.625 | 3 |
sphinx-sources/Examples/Commands/LensFresnel_Convert.py | jccmak/lightpipes | 132 | 22010 | from LightPipes import *
import matplotlib.pyplot as plt
def TheExample(N):
fig=plt.figure(figsize=(11,9.5))
ax1 = fig.add_subplot(221)
ax2 = fig.add_subplot(222)
ax3 = fig.add_subplot(223)
ax4 = fig.add_subplot(224)
labda=1000*nm;
size=10*mm;
f1=10*m
f2=1.11111111*m
z=1.0*... | 2.453125 | 2 |
delira/models/backends/chainer/__init__.py | gedoensmax/delira | 1 | 22011 | <gh_stars>1-10
from delira import get_backends as _get_backends
if "CHAINER" in _get_backends():
from delira.models.backends.chainer.abstract_network import \
AbstractChainerNetwork
from delira.models.backends.chainer.data_parallel import \
DataParallelChainerNetwork
from delira.models.back... | 1.390625 | 1 |
src/deepproblog/examples/Forth/Add/data/extract.py | vossenwout/gtadeepproblog | 54 | 22012 | <reponame>vossenwout/gtadeepproblog
import re
for train in [2, 4, 8]:
for test in [8, 64]:
for mode in ["train", "test", "dev"]:
with open("train{}_test{}/{}.txt".format(train, test, mode)) as f:
text = f.read()
matches = re.findall("\[([0-9 ]*)\]\t\[([0-9 ]*) (\d) (... | 2.53125 | 3 |
app/location/crawler.py | maro99/yapen | 1 | 22013 | <gh_stars>1-10
import re
import requests
from bs4 import BeautifulSoup
import time
from urllib import parse
from selenium import webdriver
from location.models import Pension, RoomImage, PensionImage, Room, Location, SubLocation
# 가격에 string, 100,00 표현 맞지 않는 경우 0넣고 아니면 int로 바꿔서 출력
def get_int_only(string):
a= re... | 2.640625 | 3 |
14-semparsing/ucca/scripts/find_constructions.py | ariasjose/nn4nlp-code | 0 | 22014 | from argparse import ArgumentParser
from ucca import constructions
from ucca.ioutil import read_files_and_dirs
if __name__ == "__main__":
argparser = ArgumentParser(description="Extract linguistic constructions from UCCA corpus.")
argparser.add_argument("passages", nargs="+", help="the corpus, given as... | 3.078125 | 3 |
multicache/__init__.py | bargulg/SimpleCache | 1 | 22015 | import hashlib
import os
import pickle
import tempfile
import zlib
from threading import Lock
from time import time
from multicache.base import BaseCache
try:
from multicache.redis import RedisCache
except ImportError:
pass
lock = Lock()
class DummyCache(BaseCache):
""" Fake cache class to allow a "no c... | 2.6875 | 3 |
01_numbers.py | fernandobd42/Introduction_Python | 1 | 22016 | <filename>01_numbers.py
x = 1 #x recebe 1
#print irá printar(mostrar) o valor desejado;
print(x) # resultado: 1
print(x + 4) # é possível somar uma variável com um número, desde que a variável tenha um valor definido - resultado: 5
print(2 * 2) #um asterisco é usado para multiplicar - resultado: 4
print(3 ** 3) #dois a... | 4.125 | 4 |
schematizer/models/redshift_sql_entities.py | Yelp/schematizer | 86 | 22017 | <filename>schematizer/models/redshift_sql_entities.py<gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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.apach... | 2.140625 | 2 |
modules/templates/WACOP/config.py | mswdresden/AsylumEden | 1 | 22018 | # -*- coding: utf-8 -*-
from collections import OrderedDict
from gluon import current
from gluon.storage import Storage
def config(settings):
"""
Template for WA-COP + CAD Cloud Integration
"""
T = current.T
# =========================================================================
# S... | 2.03125 | 2 |
main.py | guysoft/kivy-external-storage-permission | 1 | 22019 | import kivy
from kivy.app import App
from kivy.uix.button import Button
import android
import os
import time
from android.permissions import Permission, request_permission, check_permission
from kivy.clock import Clock
class MyApp(App):
def second_thread(self, data):
print("starting second thread")
... | 2.890625 | 3 |
my_oop/oop05.py | xxwqlee/pylearn | 1 | 22020 | """
继承调用关系
"""
class A:
def a_say(self):
print('执行A:', self)
class B(A):
def b_say(self):
A.a_say(self) # 效果与下面的语句相同
super().a_say() # super()方法调用父类的定义,
# 默认传入当前对象的引用self
A().a_say() # 类对象的直接使用,先创建一个类对象A
print('执行B:', self)
a = A()
b = B()
a.a_say()... | 4.3125 | 4 |
python/tests/sbp/utils.py | zk20/libsbp | 0 | 22021 | <filename>python/tests/sbp/utils.py
#!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Contact: https://support.swiftnav.com
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORM... | 2.046875 | 2 |
train_arg_parser.py | DaringDane/Image-Classifier | 0 | 22022 | <gh_stars>0
import argparse
'''
Example commands for the command line:
- Select directory to save checkpoints in: python train.py data_directory --save_dir save_directory
- Select training architecture: python train.py data_directory --arch "densenet121"
- Set hyperparameters: python train.py data_director... | 2.859375 | 3 |
ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_controller/test_member_controller.py | alexandru-m-g/hdx-ckan | 0 | 22023 | <filename>ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_controller/test_member_controller.py
'''
Created on Jun 23, 2015
@author: alexandru-m-g
'''
import logging
import mock
import ckan.model as model
import ckan.common as common
import ckan.lib.helpers as h
import ckan.lib.mailer as mailer
import ckanext.... | 1.765625 | 2 |
bulletin/factories.py | ralphqq/ph-earthquake-dashboard | 0 | 22024 | from datetime import timedelta
import random
from django.utils import timezone
import factory
class BulletinFactory(factory.DjangoModelFactory):
class Meta:
model = 'bulletin.Bulletin'
url = factory.Sequence(lambda n: f'https://www.sitepage.com/{n}')
latitude = factory.Faker(
... | 2.6875 | 3 |
figure2/Initialization.py | QianLab/Soft_MOCU | 1 | 22025 | <reponame>QianLab/Soft_MOCU
# -*- coding: utf-8 -*-
import numpy as np
def pz_theta_model(x, theta_r):
# x can be np.array of size 2 or a list of two np.array x1 and x2
# x = x[0]
a = theta_r[0]
b = theta_r[1]
pyx = np.exp(x)/(1+np.exp(x))*0.6+0.2 #average center
cx = a*np.exp(-x**2)+b*(... | 2.515625 | 3 |
plex_export_watched_history.py | chazlarson/plex-watched-tools | 0 | 22026 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# python3 -m pip install --force -U --user PlexAPI
"""
Metadata to be handled:
* Audiobooks
* Playlists -- https://github.com/pkkid/python-plexapi/issues/551
"""
import copy
import json
import time
import logging
import collections
from urllib.parse import urlparse
... | 2.125 | 2 |
src/models/product.py | superxuu/fastapi_pony_2 | 2 | 22027 | from datetime import datetime
from decimal import Decimal
from src.models import db, Required, Optional
class Product(db.Entity):
name = Required(str, unique=True)
price = Required(Decimal)
description = Optional(str)
create_time = Required(datetime, default=datetime.now, precision=6)
update_time... | 2.703125 | 3 |
tgthemer/themer.py | eskilop/TgThemer-py | 1 | 22028 | <filename>tgthemer/themer.py<gh_stars>1-10
#!/usr/bin/env python3
from .color import Color
import shutil
import os
std_none = "#FF000000"
class Themer:
def __init__(self, primary=std_none, secondary=std_none, accent=std_none,
mode=None, ttype="dark"):
self.primary = Color(primary)
... | 2.75 | 3 |
01 Dimensionality Reduction/Tutorial 03 - Unsupervised nonlinear embedding/isomap/dijkstra.py | KateYeon/Business-Anlaytics | 0 | 22029 | class Graph(object):
"""
A simple undirected, weighted graph
"""
def __init__(self):
self.nodes = set()
self.edges = {}
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
... | 3.875 | 4 |
fakenet/diverters/fnconfig.py | AzzOnFire/flare-fakenet-ng | 0 | 22030 | class Config(object):
"""Configuration primitives.
Inherit from or instantiate this class and call configure() when you've got
a dictionary of configuration values you want to process and query.
Would be nice to have _expand_cidrlist() so blacklists can specify ranges.
"""
def __init__(self, ... | 3.375 | 3 |
plotly/validators/layout/xaxis/_constraintoward.py | gnestor/plotly.py | 12 | 22031 | <filename>plotly/validators/layout/xaxis/_constraintoward.py
import _plotly_utils.basevalidators
class ConstraintowardValidator(
_plotly_utils.basevalidators.EnumeratedValidator
):
def __init__(
self,
plotly_name='constraintoward',
parent_name='layout.xaxis',
**kwargs
):
... | 2.109375 | 2 |
openmdao/core/test/test_group_derivatives.py | jcchin/project_clippy | 0 | 22032 | """ Testing group-level finite difference. """
import unittest
import numpy as np
from openmdao.components.param_comp import ParamComp
from openmdao.core.component import Component
from openmdao.core.group import Group
from openmdao.core.problem import Problem
from openmdao.test.converge_diverge import ConvergeDiverg... | 2.546875 | 3 |
rsbroker/core/user.py | land-pack/RsBroker | 0 | 22033 | from __future__ import absolute_import
import ujson
from rsbroker.core.upstream import RTCWebSocketClient
class BaseUserManager(object):
room_to_uid = {}
uid_to_handler = {}
def register(self, obj):
"""
Dispatch all resource which user need!
:param obj:
:return:
"... | 2.03125 | 2 |
src/constraint_solver.py | khairulislam/phys | 0 | 22034 | from pgm.pgmplayer import PGMPlayer
import cps_constraints as con
from operator import itemgetter
import uuid
import os
class ConstraintSolver:
def __init__(self, my_con_collector, my_con_scoper, SHOULD_USE_CONSTRAINT_SCOPING=False):
self.con_collector = my_con_collector
self.con_scoper = my_con_s... | 2.390625 | 2 |
cpu_ver/funkyyak/tests/test_util.py | bigaidream-projects/drmad | 119 | 22035 | <gh_stars>100-1000
import numpy as np
import itertools as it
from funkyyak import grad
from copy import copy
def nd(f, *args):
unary_f = lambda x : f(*x)
return unary_nd(unary_f, args)
def unary_nd(f, x):
eps = 1e-4
if isinstance(x, np.ndarray):
nd_grad = np.zeros(x.shape)
for dims in ... | 2.234375 | 2 |
game_main.py | smarTHh2019/melody_path_finder | 0 | 22036 | import time
import random
import pygame
import pygame.midi
import numpy as np
from typing import Tuple
__author__ = "<NAME>"
AV_SIZE = 20
WIN_X = 30 * AV_SIZE
WIN_Y = 30 * AV_SIZE
DIFF_MAX = np.sqrt(WIN_X**2 + WIN_Y**2)
def adapt_avatar_position(event, user_x_pos:int, user_y_pos:int) -> Tuple[int, int]:
i... | 2.8125 | 3 |
lib/preproc.py | ayshrv/paperpile-notion | 0 | 22037 | <filename>lib/preproc.py<gh_stars>0
from typing import Dict, List
def match(string, candidates) -> str:
for c in candidates:
if c[0].lower() in string.lower() or c[1].lower() in string.lower():
return c
for c in candidates:
if string.lower() in c[0].lower() or string.lower() in c[1... | 3.21875 | 3 |
twitter/Update.py | bhargavz/py-twitter-sentiment-analysis | 0 | 22038 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# FILE: Update.py
#
# This class provides mechanisms to update, reply to, retweet status
# messages and send direct messages
#
# Copyright by Author. All rights reserved. Not for reuse without
# express permissions.
#
import sys, time, json, logging
from sochi.twit... | 2.78125 | 3 |
library/utils/time.py | zjjott/html | 0 | 22039 | # coding=utf-8
from __future__ import unicode_literals, absolute_import
from datetime import datetime
from pytz import UTC
from dateutil.parser import parse
fmt = '%Y-%m-%d %H:%M:%S'
utc_fmt = "%Y-%m-%dT%H:%M:%SZ"
def get_utcnow():
at = datetime.utcnow()
at = at.replace(tzinfo=UTC)
return at
def isotime... | 3.1875 | 3 |
aguas_altas/build_gdb/build_gdb_table.py | PEM-Humboldt/caracterizacion_paisajes_sonoros_ppii | 0 | 22040 | <reponame>PEM-Humboldt/caracterizacion_paisajes_sonoros_ppii<filename>aguas_altas/build_gdb/build_gdb_table.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Build Geo Database for PaisajesSonorosTB
----------------------------------------
This script compiles output from multiple scripts that should be executed p... | 2.09375 | 2 |
dear_petition/petition/migrations/0008_auto_20200208_0222.py | robert-w-gries/dear-petition | 4 | 22041 | # Generated by Django 2.2.4 on 2020-02-08 02:22
from django.db import migrations
def move_batch_fks(apps, schema_editor):
Batch = apps.get_model("petition", "Batch")
CIPRSRecord = apps.get_model("petition", "CIPRSRecord")
for batch in Batch.objects.all():
print(f"Adding batch {batch.pk} to {batch... | 2 | 2 |
auto_ml/_version.py | amlanbanerjee/auto_ml | 1,671 | 22042 | <filename>auto_ml/_version.py
__version__ = "2.9.10"
| 0.957031 | 1 |
maya/libs/sceneutils.py | bhsingleton/dcc | 1 | 22043 | import maya.cmds as mc
import os
import logging
logging.basicConfig()
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
def isNewScene():
"""
Method used to check if this is an untitled scene file.
:rtype: bool
"""
return len(mc.file(query=True, sceneName=True)) == 0
def isSaveRequ... | 2.484375 | 2 |
diffir/__init__.py | capreolus-ir/diffir | 12 | 22044 | <filename>diffir/__init__.py
__version__ = "0.2.0"
from diffir.weight import Weight
from diffir.weight.custom import CustomWeight
from diffir.weight.unsupervised import ExactMatchWeight
from diffir.measure import Measure
from diffir.measure.qrels import QrelMeasure
from diffir.measure.unsupervised import TopkMeasure
f... | 1.101563 | 1 |
tool/pylib/generator/output/PartBuilder.py | mever/qooxdoo | 1 | 22045 | <reponame>mever/qooxdoo
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2006-2010 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# MIT... | 1.875 | 2 |
factorizer/datasets/wmh.py | pashtari/factorizer | 7 | 22046 | import sys
import numpy as np
import torch
from monai import transforms, data
from ..data import DataModule, ReadImaged, Renamed, Inferer
###################################
# Transform
###################################
def wmh_train_transform(
spacing=(1.0, 1.0, 1.0), spatial_size=(128, 128, 128), num_patc... | 1.960938 | 2 |
Python/Topics/Sending-Email/05-pdf-attachment.py | shihab4t/Software-Development | 0 | 22047 | <reponame>shihab4t/Software-Development
import imghdr
import smtplib
import os
from email.message import EmailMessage
EMAIL_ADDRESS = os.environ.get("GMAIL_ADDRESS")
EMAIL_PASSWORD = os.environ.get("GMAIL_APP_PASS")
pdfs = ["/home/shihab4t/Downloads/Profile.pdf"]
with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smt... | 2.546875 | 3 |
rcds/project/__init__.py | jordanbertasso/rcds | 5 | 22048 | from .project import Project # noqa: F401
| 1.03125 | 1 |
MyEircode.py | MrBrianMonaghan/mapping | 0 | 22049 | <filename>MyEircode.py<gh_stars>0
import selenium
from selenium import webdriver
try:
browser = webdriver.Firefox()
browser.get('mikekus.com')
except KeyboardInterrupt:
browser.quit()
| 2.03125 | 2 |
tests/test_rotor/rotor_test.py | axevalley/enigma | 0 | 22050 | """Base class for rotor tests."""
import unittest
from enigma.rotor.reflector import Reflector
from enigma.rotor.rotor import Rotor
class RotorTest(unittest.TestCase):
"""Provides tools testing rotors."""
def get_rotor(
self,
wiring="EKMFLGDQVZNTOWYHXUSPAIBRCJ",
ring_setting=1,
... | 2.9375 | 3 |
kyu_8/check_the_exam/test_check_exam.py | pedrocodacyorg2/codewars | 1 | 22051 | # Created by <NAME>.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
# FUNDAMENTALS ARRAYS NUMBERS BASIC LANGUAGE FEATURES
import unittest
import allure
from utils.log_func import print_log
from kyu_8.check_the_exam.check_exam import check_exam
@allure.epic('8 kyu')
@all... | 3.125 | 3 |
pysoup/venv/__init__.py | illBeRoy/pysoup | 4 | 22052 | import os.path
from twisted.internet import defer
import pysoup.utils
class Virtualenv(object):
def __init__(self, display_pip, path):
self._display_pipe = display_pip
self._path = path
@property
def path(self):
return self._path
@property
def venv_path(self):
... | 2.125 | 2 |
yggdrasil/metaschema/datatypes/InstanceMetaschemaType.py | astro-friedel/yggdrasil | 0 | 22053 | from yggdrasil.metaschema.datatypes import MetaschemaTypeError
from yggdrasil.metaschema.datatypes.MetaschemaType import MetaschemaType
from yggdrasil.metaschema.datatypes.JSONObjectMetaschemaType import (
JSONObjectMetaschemaType)
from yggdrasil.metaschema.properties.ArgsMetaschemaProperty import (
ArgsMetasch... | 2.515625 | 3 |
battleships/migrations/0004_auto_20181202_1852.py | ArturAdamczyk/Battleships | 0 | 22054 | # Generated by Django 2.1.3 on 2018-12-02 17:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('battleships', '0003_auto_20181202_1832'),
]
operations = [
migrations.RenameField(
model_name='coordinate',
old_name='ship',... | 1.757813 | 2 |
jme/stagecache/text_metadata.py | jmeppley/stagecache | 0 | 22055 | <reponame>jmeppley/stagecache
"""
Functions for storing and retrieving cache metadata from text files.
Each Cache asset is a path: /path/filename
There are four metadata files in the cache for each:
/path/.stagecache.filename/size The size of the asset in bytes
/path/.stagecache.filename/cache_lock The r... | 3.15625 | 3 |
lib/roi_data/minibatch.py | BarneyQiao/pcl.pytorch | 233 | 22056 | <reponame>BarneyQiao/pcl.pytorch<gh_stars>100-1000
import numpy as np
import numpy.random as npr
import cv2
from core.config import cfg
import utils.blob as blob_utils
def get_minibatch_blob_names(is_training=True):
"""Return blob names in the order in which they are read by the data loader.
"""
# data b... | 2.71875 | 3 |
src/PrimaryInputs.py | elastacloud/input-output-tables | 0 | 22057 | import abc
import os
import pandas as pd
import numpy as np
from EoraReader import EoraReader
class PrimaryInputs(EoraReader):
def __init__(self, file_path):
super().__init__(file_path)
self.df = None
def get_dataset(self, extended = False):
"""
Returns a pandas dataframe conta... | 3 | 3 |
toto/methods/client_error.py | VNUELIVE/Toto | 0 | 22058 | import logging
from toto.invocation import *
@requires('client_error', 'client_type')
def invoke(handler, parameters):
'''A convenince method for writing browser errors
to Toto's server log. It works with the ``registerErrorHandler()`` method in ``toto.js``.
The "client_error" parameter should be set to the str... | 2.6875 | 3 |
parallelformers/policies/gptj.py | Oaklight/parallelformers | 454 | 22059 | <reponame>Oaklight/parallelformers
# Copyright 2021 TUNiB 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... | 1.648438 | 2 |
app/modules/checkerbox.py | hboueix/PyCheckers | 0 | 22060 | <reponame>hboueix/PyCheckers<filename>app/modules/checkerbox.py
import pygame
class Checkerbox(pygame.sprite.Sprite):
def __init__(self, size, color, coords):
super().__init__()
self.rect = pygame.Rect(coords[0], coords[1], size, size)
self.color = color
self.hovered = False
... | 2.859375 | 3 |
tests/python/test_talos_walk_sl1m_topt.py | daeunSong/multicontact-locomotion-planning | 31 | 22061 | <gh_stars>10-100
# Copyright (c) 2020, CNRS
# Authors: <NAME> <<EMAIL>>
import unittest
import subprocess
import time
from mlp import LocoPlanner, Config
from utils import check_motion
from hpp.corbaserver.rbprm.utils import ServerManager
class TestTalosWalkSl1mTopt(unittest.TestCase):
def test_talos_walk_sl1m_top... | 1.90625 | 2 |
definitions.py | elpeix/kaa | 0 | 22062 | <reponame>elpeix/kaa
import os
import logging
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
LOG = logging.getLogger()
NAME = 'Sample Server'
VERSION = 'v1.0'
SERVER = 'example.SampleServer'
ENABLE_CORS = True
| 1.382813 | 1 |
uncertainty_baselines/datasets/smcalflow.py | y0ast/uncertainty-baselines | 0 | 22063 | <reponame>y0ast/uncertainty-baselines
# coding=utf-8
# Copyright 2021 The Uncertainty Baselines Authors.
#
# 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... | 1.695313 | 2 |
1-FrequencyDivisionMultiplexing.py | mahnooranjum/Demo_CommunicationSystems | 0 | 22064 | <filename>1-FrequencyDivisionMultiplexing.py<gh_stars>0
'''
==============================================================================
Author:
<NAME>
Description:
Digital Multiplexing Techniques:
1- Frequency Division Multiplexing
Contact:
<EMAIL>
====================... | 3.421875 | 3 |
deep-rl/lib/python2.7/site-packages/OpenGL/GL/ATI/text_fragment_shader.py | ShujaKhalid/deep-rl | 210 | 22065 | '''OpenGL extension ATI.text_fragment_shader
This module customises the behaviour of the
OpenGL.raw.GL.ATI.text_fragment_shader to provide a more
Python-friendly API
Overview (from the spec)
The ATI_fragment_shader extension exposes a powerful fragment
processing model that provides a very general means of expr... | 1.867188 | 2 |
vhog3d.py | parthsuresh/3dvhog | 3 | 22066 | <reponame>parthsuresh/3dvhog
import numpy as np
import math
from scipy.ndimage import convolve
from tqdm import tqdm
def hog3d(vox_volume, cell_size, block_size, theta_histogram_bins, phi_histogram_bins, step_size=None):
"""
Inputs
vox_volume : a [x x y x z] numpy array defining voxels with values in th... | 2.75 | 3 |
tests/urls.py | skioo/django-datatrans | 9 | 22067 | <filename>tests/urls.py
from django.urls import include, path
from datatrans.views import example
urlpatterns = [
path(r'^datatrans/', include('datatrans.urls')),
path(r'^example/register-credit-card$', example.register_credit_card, name='example_register_credit_card'),
path(r'^example/pay$', example.pay,... | 1.9375 | 2 |
gibbs/minimization.py | volpatto/gibbs | 28 | 22068 | import attr
import types
from typing import Union
from enum import Enum
import numpy as np
from scipy.optimize import differential_evolution
import pygmo as pg
class OptimizationMethod(Enum):
"""
Available optimization solvers.
"""
SCIPY_DE = 1
PYGMO_DE1220 = 2
@attr.s(auto_attribs=True)
class S... | 2.90625 | 3 |
tests/unittests/types/test_array.py | TrigonDev/apgorm | 8 | 22069 | # MIT License
#
# Copyright (c) 2021 TrigonDev
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | 1.882813 | 2 |
cisco_support/__version__.py | rothdennis/cisco_support | 4 | 22070 | __title__ = 'cisco_support'
__description__ = 'Cisco Support APIs'
__version__ = '0.1.0'
__author__ = '<NAME>'
__license__ = 'MIT'
| 0.902344 | 1 |
code/searchers.py | trunc8/mespp | 2 | 22071 | <filename>code/searchers.py<gh_stars>1-10
#!/usr/bin/env python3
# trunc8 did this
import numpy as np
class Searchers:
def __init__(self, g,
N=100,
M=2,
initial_positions=np.array([90,58]),
target_initial_position=45):
'''
g: Graph of environment
... | 3.0625 | 3 |
vogue/api/api_v1/api.py | mayabrandi/vogue | 1 | 22072 | from fastapi import FastAPI
from vogue.api.api_v1.endpoints import (
insert_documents,
home,
common_trends,
sequencing,
genootype,
reagent_labels,
prepps,
bioinfo_covid,
bioinfo_micro,
bioinfo_mip,
update,
)
from vogue.settings import static_files
app = FastAPI()
app.mount... | 1.710938 | 2 |
models/dgcnn.py | veronicatozzo/SimpleView | 95 | 22073 |
import torch.nn as nn
import torch.nn.functional as F
from dgcnn.pytorch.model import DGCNN as DGCNN_original
from all_utils import DATASET_NUM_CLASS
class DGCNN(nn.Module):
def __init__(self, task, dataset):
super().__init__()
self.task = task
self.dataset = dataset
if task == "... | 2.890625 | 3 |
atcoder/arc/a036.py | tomato-300yen/coding | 0 | 22074 | from collections import deque
N, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
ans_dq = deque([0, 0, 0])
for i, t in enumerate(T):
ans_dq.append(t)
ans_dq.popleft()
if sum(ans_dq) < K and i > 1:
print(i + 1)
break
else:
print(-1)
| 2.75 | 3 |
Python/Curos_Python_curemvid/Exercicios_dos_videos/Ex029.py | Jhonattan-rocha/Meus-primeiros-programas | 0 | 22075 | velocidade = float(input("Digite a sua velocidade em Km/h: "))
if velocidade > 80:
amais = velocidade - 80
amais = amais*7
print("Você foi multado, devera pagar uma multa de: R${:.2f}".format(amais))
print("FIM, não se mate")
| 3.890625 | 4 |
research/radar-communication/dqn_agent.py | hieunq95/keras-rl | 0 | 22076 | <gh_stars>0
import numpy as np
import gym
import argparse
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten, Convolution2D
from keras.optimizers import Adam
from rl.agents.dqn import DQNAgent
from rl.policy import LinearAnnealedPolicy, EpsGreedyQPolicy
from rl.memory import Seque... | 1.9375 | 2 |
Chapter01/displacy-save-as-image-1-4-5.py | indrasmartmob/Mastering-spaCy | 76 | 22077 | <gh_stars>10-100
#!/usr/bin/env python3
import spacy
from spacy import displacy
from pathlib import Path
nlp = spacy.load("en_core_web_md")
doc = nlp("I'm a butterfly.")
svg = displacy.render(doc, style="dep", jupyter=False)
filename = "butterfly.svg"
output_path = Path(filename)
output_path.open("w", encoding="utf-8... | 2.40625 | 2 |
mask_detector/opencv/camera_ver2.py | osamhack2021/AI_Mask_Detector | 0 | 22078 | import cv2
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
import numpy as np
model = "./AI_Mask_Detector/res10_300x300_ssd_iter_140000_fp16.caffemodel"
config = "./AI_Mask_Detector/deploy.prototxt"
# model = './AI_Mask_Detector/opencv_face_detector_uint8.pb'
# config = './AI_Mask_... | 2.703125 | 3 |
pipelines/head-pose-pipeline/training/models.py | tonouchi510/kfp-project | 0 | 22079 | <gh_stars>0
import sys
import logging
import numpy as np
import tensorflow as tf
from tensorflow.keras import backend as K
from capsulelayers import CapsuleLayer
from capsulelayers import MatMulLayer
from loupe_keras import NetVLAD
sys.setrecursionlimit(2**20)
np.random.seed(2**10)
# Custom layers
# Note - Usage of ... | 1.84375 | 2 |
remijquerytools/__init__.py | kdahlhaus/remi-jquery-tools | 0 | 22080 | <filename>remijquerytools/__init__.py
import remi.gui as gui
import os
import logging
log = logging.getLogger('remi.gui.remijquerytools.overlay')
def get_res_path():
""" return addtion to 'res' path for items needed by this lib """
res_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'res')
... | 2.546875 | 3 |
Python_Advanced_Softuni/Comprehensions_Exericises/venv/number_classification.py | borisboychev/SoftUni | 1 | 22081 | <reponame>borisboychev/SoftUni
elements = [int(x) for x in input().split(', ')]
even_numbers = [x for x in elements if x % 2 == 0]
odd_numbers = [x for x in elements if x % 2 != 0]
positive = [x for x in elements if x >= 0]
negative = [x for x in elements if x < 0]
print(f"Positive: {', '.join(str(x) for x in positiv... | 4.0625 | 4 |
src/probnum/type.py | ralfrost/probnum | 0 | 22082 | import numbers
from typing import Iterable, Tuple, Union
import numpy as np
########################################################################################
# API Types
########################################################################################
ShapeType = Tuple[int, ...]
RandomStateType = Unio... | 2.984375 | 3 |
src/socialprofile/views.py | DLRSP/django-sp | 1 | 22083 | <reponame>DLRSP/django-sp<filename>src/socialprofile/views.py
"""Django Views for the socialprofile module"""
import json
import logging
import sweetify
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import REDIRECT_FIELD_NAME, login
from django.contrib.auth import logout... | 2 | 2 |
sources/101_test.py | Painatalman/python101 | 0 | 22084 | from fruits import validate_fruit
fruits = ["banana", "lemon", "apple", "orange", "batman"]
print fruits
def list_fruits(fruits, byName=True):
if byName:
# WARNING: this won't make a copy of the list and return it. It will change the list FOREVER
fruits.sort()
for index, fruit in enumerate... | 3.953125 | 4 |
tests/test_cms_config.py | Aiky30/djangocms-content-expiry | 0 | 22085 | <reponame>Aiky30/djangocms-content-expiry<filename>tests/test_cms_config.py<gh_stars>0
from unittest.mock import Mock
from django.apps import apps
from django.contrib import admin
from django.test import RequestFactory, TestCase
from djangocms_moderation.cms_config import ModerationExtension
from djangocms_moderation... | 2.203125 | 2 |
tilequeue/format/OSciMap4/StaticVals/__init__.py | ducdk90/tilequeue | 29 | 22086 | vals = {
"yes" : 0,
"residential" : 1,
"service" : 2,
"unclassified" : 3,
"stream" : 4,
"track" : 5,
"water" : 6,
"footway" : 7,
"tertiary" : 8,
"private" : 9,
"tree" : 10,
"path" : 11,
"forest" : 12,
"secondary" : 13,
"house" : 14,
"no" : 15,
"asphalt" : 16,
"wood" : 17,
"grass" : 18,
"paved" : 19,
"primary" : 20,
"un... | 1.726563 | 2 |
encryption_client.py | salmanhiro/fernet-rabbitmq | 0 | 22087 | <gh_stars>0
import pika
import uuid
import time
import json
class FernetRpc(object):
def __init__(self):
self.connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost'))
self.channel = self.connection.channel()
result = self.channel.queue_declare(queue=... | 2.46875 | 2 |
services/cert_server/project/tests/test_cert_server.py | EvaldoNeto/openvpn-http | 5 | 22088 | # services/ovpn_server/project/tests/test_ovpn_server.py
import os
import json
import io
from flask import current_app
from project.tests.base import BaseTestCase
class TestOvpnServer(BaseTestCase):
def test_certificates(self):
with self.client:
pki_path = current_app.config['PKI_PATH']
... | 2.375 | 2 |
powerline/lib/watcher/stat.py | MrFishFinger/powerline | 11,435 | 22089 | <gh_stars>1000+
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
from threading import RLock
from powerline.lib.path import realpath
class StatFileWatcher(object):
def __init__(self):
self.watches = {}
self.lock = RLock()
def watch(... | 2.375 | 2 |
refData/mlpy/mlpy-3.5.0/mlpy/bordacount/borda.py | xrick/DTW-Tutorial | 0 | 22090 | <filename>refData/mlpy/mlpy-3.5.0/mlpy/bordacount/borda.py
## This code is written by <NAME>, <<EMAIL>>.
## (C) 2010 mlpy Developers.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either v... | 2.390625 | 2 |
envs/base_mujoco_env.py | zaynahjaved/AWAC | 0 | 22091 | <reponame>zaynahjaved/AWAC<gh_stars>0
'''
All cartgripper env modules built on cartrgipper implementation in
https://github.com/SudeepDasari/visual_foresight
'''
from abc import ABC
from mujoco_py import load_model_from_path, MjSim
import numpy as np
from base_env import BaseEnv
class BaseMujocoEnv(BaseEnv, ABC):
... | 2.265625 | 2 |
HackerRank/Two Sum/Two Sum.py | nikku1234/Code-Practise | 9 | 22092 | <filename>HackerRank/Two Sum/Two Sum.py<gh_stars>1-10
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""Naive Logic"""
''' for i in range(len(nums)):
left = nums[i+1:]
for j in range(len(left)):
if (nums[i]+left[j]) ==target :
... | 3.546875 | 4 |
Desafios/desafio009.py | LucasHenrique-dev/Exercicios-Python | 1 | 22093 | n1 = int(input('Digite um número e veja qual a sua tabuada: '))
n = 0
print('{} X {:2} = {:2}'.format(n1, 0, n1*n))
while n < 10:
n += 1
print('{} X {:2} = {:2}'.format(n1, n, n1*n))
| 3.953125 | 4 |
web/app/djrq/admin/admin.py | bmillham/djrq2 | 1 | 22094 | # encoding: utf-8
from web.ext.acl import when
from ..templates.admin.admintemplate import page as _page
from ..templates.admin.requests import requeststemplate, requestrow
from ..templates.requests import requestrow as rr
from ..send_update import send_update
import cinje
@when(when.matches(True, 'session.authentica... | 1.84375 | 2 |
Middle/Que33.py | HuangZengPei/LeetCode | 2 | 22095 | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
return binarySearch(nums,target,0,len(nums)-1)
def binarySearch(nums, target, low, high):
if (low > high):
return -1
... | 3.640625 | 4 |
save.py | regismeyssonnier/NeuralNetwork | 0 | 22096 | <gh_stars>0
def write_file(filess, T):
f = open(filess, "w")
for o in T:
f.write("[\n")
for l in o:
f.write(str(l)+"\n")
f.write("]\n")
f.close()
def save_hidden_weight(nb_hidden, hiddenw):
for i in range(nb_hidden):
write_file("save/base_nn_hid_" + str(i+1) + "w.nn", hiddenw[i])
def load_hidden... | 2.8125 | 3 |
test_knot_hasher.py | mmokko/aoc2017 | 0 | 22097 | from unittest import TestCase
from day10 import KnotHasher
class TestKnotHasher(TestCase):
def test_calc(self):
sut = KnotHasher(5, [3, 4, 1, 5])
self.assertEqual(12, sut.calc())
def test_hash1(self):
sut = KnotHasher(256, '')
self.assertEqual('a2582a3a0e66e6e86e3812dcb672a272... | 3.140625 | 3 |
udp/src/server.py | matthewchute/net-prot | 0 | 22098 | <reponame>matthewchute/net-prot
import constants, helpers, os
temp_msg = None
whole_msg = b''
file_path = None
helpers.sock.bind(constants.IP_PORT)
print "Server Ready"
# recieve
while temp_msg != constants.EOF:
datagram = helpers.sock.recvfrom(constants.BUFFER_SIZE)
temp_msg = datagram[0]
if file_pat... | 2.3125 | 2 |
sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/hostname_configuration.py | tzhanl/azure-sdk-for-python | 1 | 22099 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 1.921875 | 2 |