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 |
|---|---|---|---|---|---|---|
services/traction/api/endpoints/routes/innkeeper.py | Open-Earth-Foundation/traction | 0 | 55100 | <reponame>Open-Earth-Foundation/traction
import logging
from typing import List
from uuid import UUID
from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from starlette import status
from api.db.errors import DoesNotExist
from api.db.models.tenant import TenantRead
from api.db.model... | 2.0625 | 2 |
z42/z42/lib/b64uuid.py | jumploop/collection_python | 0 | 55101 | <filename>z42/z42/lib/b64uuid.py
#!/usr/bin/env python
#coding:utf-8
from uuid import uuid4
from base64 import urlsafe_b64encode
def b64uuid():
return urlsafe_b64encode(uuid4().bytes).rstrip('=')
if __name__ == '__main__':
print b64uuid()
| 2.484375 | 2 |
tests/hydropper/utils/session.py | ican2002/stratorvirt | 66 | 55102 | # Copyright (c) 2021 Huawei Technologies Co.,Ltd. All rights reserved.
#
# StratoVirt is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan
# PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http:#license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PRO... | 2.125 | 2 |
src/ui/buttonpanel.py | chobocho/timer | 0 | 55103 | <gh_stars>0
import wx
WINDOW_SIZE = 480
class ButtonPanel(wx.Panel):
def __init__(self, *args, parent_, cbtimer_, **kw):
super(ButtonPanel, self).__init__(*args, **kw)
self.parent = parent_
self.cbtimer = cbtimer_
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnT... | 2.515625 | 3 |
compiled/construct/bits_signed_b64_le.py | dgelessus/ci_targets | 4 | 55104 | from construct import *
from construct.lib import *
bits_signed_b64_le = Struct(
'a_num' / ???,
'a_bit' / ???,
'b_num' / ???,
'b_bit' / ???,
)
_schema = bits_signed_b64_le
| 1.53125 | 2 |
src/tasks/iptable.py | comafire/st-kilda-pier | 8 | 55105 | <reponame>comafire/st-kilda-pier
from __future__ import with_statement
from invoke import task
import env, utils
@task(help={'eth': "public ethernet device name."})
def masquerade(c, eth):
cmd = "sudo /sbin/iptables -t nat -A POSTROUTING -o {} -j MASQUERADE".format(eth)
utils.run_with_exit(c, cmd)
cmd = "s... | 2 | 2 |
idfield/fields.py | lis-space/django-idfield | 0 | 55106 | <gh_stars>0
from django.db import models
import random
class IDField(models.Field):
def __init__(self, alphabet=None, readable=False, *args, **kwargs):
self.max_length = kwargs.get('max_length', 10)
self.readable = readable
self.alphabet = alphabet
if not self.alphabet:
... | 2.40625 | 2 |
src/modules/graph.py | fivegrant/yhack2019 | 0 | 55107 | from neo4j import GraphDatabase
class AddressGraph:
def __init__(self, address, password):
self.connection = GraphDatabase.driver(address, auth=("neo4j", password))
def write(self, query):
with self.connection.session() as session:
session.run(query)
def read(self, query):
with self.connect... | 2.796875 | 3 |
perception/sub8_perception/sub8_vision_tools/labelling/pickle_combiner.py | ericgorday/SubjuGator | 27 | 55108 | <gh_stars>10-100
import pickle
import argparse
import sys
if __name__ == '__main__':
usage_msg = ("Pass the path to an arbitrary number of pickle files.")
desc_msg = "Used to combine multiple pickles into one."
parser = argparse.ArgumentParser(usage=usage_msg, description=desc_msg)
parser.add_argument... | 3.046875 | 3 |
src/model/_sample.py | hukuda222/Chat-Yojo-Bot | 2 | 55109 | <filename>src/model/_sample.py
import sys
import time
import argparse
import numpy as np
import chainer
from chainer import cuda
from chainer import optimizers
from _DataProcessing import *
from _Model import *
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
if __name__ == "__main__":
... | 2.078125 | 2 |
vedadet/criteria/losses/builder.py | jie311/vedadet | 424 | 55110 | from vedacore.misc import build_from_cfg, registry
def build_loss(cfg):
return build_from_cfg(cfg, registry, 'loss')
| 1.734375 | 2 |
src/pyrin/database/orm/query/exceptions.py | wilsonGmn/pyrin | 0 | 55111 | <filename>src/pyrin/database/orm/query/exceptions.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
orm query exceptions module.
"""
from pyrin.core.exceptions import CoreException
class ORMQueryException(CoreException):
"""
orm query exception.
"""
pass
class ORMQueryBusinessException(ORMQueryException):
... | 1.976563 | 2 |
src/csbuilder/scheme/__init__.py | huykingsofm/csbuilder | 0 | 55112 | <reponame>huykingsofm/csbuilder
from csbuilder.scheme.scheme import Scheme
from csbuilder.scheme.result import SchemeResult | 0.898438 | 1 |
chemplot/parameters.py | mcsorkun/ChemPlot | 32 | 55113 | # Authors: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
#
# License: BSD 3 clause
import math
######### Linear Models Functions #########
validator = lambda x: max(2, int(x))
predictor = lambda t, m, x: t+m*(x)
######### Perplexity Parameters #########
P_INTERCEPT_STRUCTURAL = -37.360438135651975
P_COEFFICIENT_STRUCTURAL = 8... | 2.34375 | 2 |
Service/app.py | marcosmarcon/Oracle-and-Grafana-integration | 1 | 55114 | <filename>Service/app.py
from Configuration.influx import InfluxConnection
from Configuration.oracle_conection import OracleConnection
from query.anonymous_block import example_1
from query.query import query
def example_anonymous_block():
return_example_1 = example_1()
save_influx_anonymous_block(return_examp... | 2.5625 | 3 |
apps/live_twitter_sentiment.py | VaishnaviVV/Covid19_sentiment_analysis | 2 | 55115 | #Essential Modules
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Dashboard Modules
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objects as go
from dash.dependencies import Input, Output
import da... | 2.453125 | 2 |
edd_utils/urls.py | TeselaGen/jbei-edd | 0 | 55116 | <reponame>TeselaGen/jbei-edd
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from . import views
urlpatterns = [
url(r'^$', views.utilities_index, name='index'),
url(r'^gc_ms$', views.gcms_home, name='gc_ms_home'),
url(r'^gc_ms/parse$', views.gcms_parse, name='pa... | 1.851563 | 2 |
cog/forms/forms_utils.py | downiec/COG | 6 | 55117 | '''
General utilities for form validation
@author: <NAME>
'''
import os
import imghdr
def validate_image(form, field_name):
'''
Validates an image field that is part of a form,
before the image is uploaded to the server.
'''
cleaned_data = form.cleaned_data
image = cleaned_data.get(field... | 3.265625 | 3 |
src/main/python/test/__init__.py | vasnake/spark.ml.SpatialJoinTransformer | 2 | 55118 | <filename>src/main/python/test/__init__.py
# -*- coding: utf-8 -*-
from pandas.util.testing import assert_frame_equal
from .spark_fixture import local_spark
| 1.351563 | 1 |
source/miniworldmaker/__init__.py | teerasanqq/miniworldmaker | 0 | 55119 | import miniworldmaker.tokens.token
import miniworldmaker.tokens.actor
from miniworldmaker.tokens import token
import miniworldmaker.containers.container as container
import miniworldmaker.windows.miniworldwindow as window
import miniworldmaker.tools.db_manager as db_manager
from miniworldmaker import boards
from miniwo... | 1.367188 | 1 |
megalista_dataflow/models/sheets_config.py | omnicomdatahousecl/megalista | 44 | 55120 | # Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.3125 | 2 |
setup.py | dezren39/gitstats | 15 | 55121 | <gh_stars>10-100
#!/usr/bin/env python
from distutils.core import setup
import gitstats
def readme():
try:
with open('README.rst') as f:
return f.read()
except:
return '(Could not read from README.rst)'
with open('requirements.txt') as fin:
install_reqs = fin.readlines()
... | 1.53125 | 2 |
pubtrack/pubs/api/urls.py | the16thpythonist/pubtrack | 0 | 55122 | from django.urls import include, path
from rest_framework.routers import DefaultRouter
from pubtrack.pubs.api.views import (AuthorListCreateAPIView,
AuthorRUDAPIView,
MetaAuthorListCreateAPIView,
MetaAuthorR... | 2.140625 | 2 |
quick_sort.py | Snowerest/leetcodeQuestion-Python | 1 | 55123 | def quick_sort(nums: list) -> list:
if len(nums) <= 1:
return nums
mid = nums[0]
return quick_sort([i for i in nums if i < mid]) + [mid] + quick_sort([i for i in nums if i > mid])
| 3.59375 | 4 |
app/schemas/entities/user.py | maxzhenzhera/my_vocab_backend | 0 | 55124 | <reponame>maxzhenzhera/my_vocab_backend<filename>app/schemas/entities/user.py
from datetime import datetime
from pydantic import (
BaseModel,
EmailStr
)
from ..base import (
IDModelMixin,
ModelWithOrmMode
)
__all__ = [
'UserInCreate',
'UserInLogin',
'UserInUpdate',
'UserInResponse'
]... | 2.359375 | 2 |
utils/result.py | ricoshin/learn2sample | 1 | 55125 | <filename>utils/result.py
"""
Usage:
ResultList(List) -> ResultDict(OrderedDict) -> ResultFrame(pd.DataFrame)
Example:
result_dict = ResultDict()
result_dict.append(key_0=value_00, key_1=value_01), ...)
result_dict.append(key_0=value_01, key_1=value_11), ...)
>>> result_dict = ResultDict({
... | 3.015625 | 3 |
distiller/data/models/__init__.py | 18F/FAC-Distiller- | 2 | 55126 | from .assistance_listings import *
from .meta import *
from .pdf_extract import *
from .single_audit_db import *
| 1.007813 | 1 |
ocbind/system/aaa/server_groups/server_group/servers/server/state/__init__.py | SeanCondon/onos-config-demo | 1 | 55127 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes... | 1.75 | 2 |
src/model/bc.py | dtak/batch-apprenticeship-learning | 2 | 55128 | '''
original implementation credit: https://github.com/openai/baselines
heavily adapted to suit our needs.
'''
import argparse
import tempfile
import os.path as osp
import gym
import logging
from tqdm import tqdm
import tensorflow as tf
import numpy as np
import os
import sys
import glob
file_path = os.path.dirnam... | 1.921875 | 2 |
game/python-packages/discord_rpc/connection/ipc.py | JustYourBud/Bad-Times-of-Romance | 2 | 55129 | from __future__ import absolute_import
import errno
import logging
from ..codes import errorcodes
from ..util.utils import is_windows, range, get_temp_path, to_bytes, bytes, to_unicode, is_python3, is_callable
import struct
import sys
if is_windows():
# we're going to have to do some ugly things, because Windows su... | 1.984375 | 2 |
6 programs work/logarithm.py | ScriptErrorVGM/Project2021 | 0 | 55130 | <filename>6 programs work/logarithm.py
import math
def main():
def logList(numList):
for i in range(len(numList)):
if numList[i] > 0:
numList[i] = math.log(numList[i])
else:
numList[i] = None
return numList
numList = ... | 3.578125 | 4 |
product/urls.py | yusif763/Unistore-pro | 3 | 55131 | <reponame>yusif763/Unistore-pro
from django.contrib import admin
from django.urls import path,include
from product.views import ProductDetailView , ProductListView
from django.conf import settings
from django.conf.urls.static import static
app_name = "product"
urlpatterns = [
path('product-list/', ProductListVie... | 1.625 | 2 |
Backend/BackendServices/DungeonManager.py | LukasKlein00/SWEProjekt2021 | 6 | 55132 | # region HEADER
# !/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, The MUDCake Project"
__credits__ = "<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>"
__license__ = """MIT License
Copyright (c) 2021 MUDCake Project
... | 1.640625 | 2 |
test/test_clang_qt6_test.py | shift-left-test/meta-shift | 2 | 55133 | #-*- coding: utf-8 -*-
#!/usr/bin/python3
"""
Copyright (c) 2020 LG Electronics Inc.
SPDX-License-Identifier: MIT
"""
import pytest
def test_core_image_minimal_do_checkcodeall(test_clang_qt6_build):
o = test_clang_qt6_build.shell.execute("bitbake core-image-minimal -c checkcodeall")
assert o.stdout.contains... | 1.90625 | 2 |
idfy_rest_client/models/jwt_validation_request.py | dealflowteam/Idfy | 0 | 55134 | <reponame>dealflowteam/Idfy<filename>idfy_rest_client/models/jwt_validation_request.py
# -*- coding: utf-8 -*-
"""
idfy_rest_client.models.jwt_validation_request
This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io )
"""
class JwtValidationRequest(object):
""... | 2.28125 | 2 |
LeetCodeSolutions/LeetCode_0083.py | lih627/python-algorithm-templates | 24 | 55135 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
dummy = ListNode(None)
dummy.next = head
p = dummy
while p.next:
... | 3.578125 | 4 |
ezored/app/__init__.py | archive-repository/ezored-udemy | 0 | 55136 | """modules"""
__all__ = ["const"]
| 1.03125 | 1 |
efficient_vdvae_torch/utils/utils.py | Rayhane-mamah/Efficient-VDVAE | 41 | 55137 | <reponame>Rayhane-mamah/Efficient-VDVAE
import torch
import os
import numpy as np
from hparams import HParams
from collections import defaultdict
from torch.utils.tensorboard import SummaryWriter
from prettytable import PrettyTable
hparams = HParams.get_hparams_by_name("efficient_vdvae")
def get_logdir():
return... | 2.125 | 2 |
bsh.py | julianpistorius/bitsynchub | 0 | 55138 | <reponame>julianpistorius/bitsynchub<gh_stars>0
import cgi, re, json
import worker
import notifications
import traceback
def root(environ):
post = cgi.FieldStorage(
fp=environ['wsgi.input'],
environ=environ,
keep_blank_values=True
)
email = post['email'].value if 'email' in post... | 2.15625 | 2 |
designer/keyboard.py | designer-edu/designer | 3 | 55139 | <filename>designer/keyboard.py
"""The keyboard modules provides an interface to adjust the keyboard's repeat
rate.
.. attribute:: repeat
When the keyboard repeat is enabled, keys that are held down will keep
generating new events over time. Defaults to `False`.
.. attribute:: delay
`int` to control how ... | 3.359375 | 3 |
cluster/nothing_cluster.py | bitmapup/mmc3 | 0 | 55140 | import logging
from mmc.mobilitytrace import MobilityTrace
class Djcluster (Cluster):
def __init__ (self,trialMobilityTraces, speed=0.1):
self._trialMobilityTraces = trialMobilityTraces
self._speed=speed
self._clusters =[] # List of sets of Mobility traces grouped by cluster
""" s... | 2.265625 | 2 |
examples/logs/prepare_memory_log.py | anagainaru/iSBatch | 0 | 55141 | import glob
import numpy as np
import sys
def group_memory_footprint(memory_list, th_size):
# group similar consecutive entries in the memory list (ts, size)
ts = 0
size_list = [memory_list[0][1]]
group_footprint = []
for i in range(1, len(memory_list)):
if abs(memory_list[i][1] - memory_li... | 2.671875 | 3 |
conll_reader.py | draplater/msg-parser | 3 | 55142 | from __future__ import unicode_literals
import codecs
from collections import namedtuple
import sys
import six
from typing import Union, Optional, List
from namedlist import namedlist
class CoNLLNode(object):
@classmethod
def from_line(cls, line):
fields = line.split()
try:
re... | 2.78125 | 3 |
Top 20 Dynammic Programming Problems GFG/number_of_ways_to_cover_a_distance.py | debjit31/leetcode-solutions | 0 | 55143 | <filename>Top 20 Dynammic Programming Problems GFG/number_of_ways_to_cover_a_distance.py
# Given a distance ‘dist, count total number of ways to cover the distance with 1, 2 and 3 steps.
# Input: n = 3
# Output: 4
# Explantion:
# Below are the four ways
# 1 step + 1 step + 1 step
# 1 step + 2 step
# 2 step + 1 step... | 3.796875 | 4 |
apps/objects/processors.py | iamjdcollins/districtwebsite | 0 | 55144 | <reponame>iamjdcollins/districtwebsite<filename>apps/objects/processors.py
from .models import Node
import mptt
import apps.common.functions as commonfunctions
def breadcrumb(request):
breadcrumb = Node.objects.filter(url=request.path, site=request.site).get_ancestors(include_self=True)
return {'BREADCRUMB': b... | 1.992188 | 2 |
api_data_template.py | molibdenium/ftx_autolend | 2 | 55145 | # -*- coding: utf-8 -*-
ftx = {
'apiKey':"your_api_key_here" ,
'secret':"your_api_secret_here",
}
| 1.007813 | 1 |
tests/test_gis_utils.py | couasnonanais/hydromt | 12 | 55146 | """Test for hydromt.gis_utils submodule"""
import pytest
import numpy as np
from hydromt import gis_utils as gu
from hydromt.raster import full_from_transform, RasterDataArray
from rasterio.transform import from_origin
def test_crs():
bbox = [3, 51.5, 4, 52] # NL
assert gu.utm_crs(bbox).to_epsg() == 32631
... | 2.140625 | 2 |
scripts/wikipedia_list_scraping.py | nuno-silva18/VG-DAPI | 0 | 55147 | """This module scrapes game information from wikipedia lists to compile into a database"""
import pandas as pd
import pymysql
def connectDatabase():
"""Create database connection"""
global db
db = pymysql.connect(host='localhost', user='root', password='',
db='vg_dapi', cursorclass... | 3.484375 | 3 |
feed_list.py | 2502302255/al789 | 28 | 55148 | from main.save_and_get import Abrufen
import config
example1 = Abrufen(config.bucket_name, config.subdir4rss, 'example1')
example2 = Abrufen(config.bucket_name, config.subdir4rss, 'example2')
| 1.773438 | 2 |
src/Dominion/Actioncards/Vassal.py | CarlGathmann/Dominion | 0 | 55149 | from src.Dominion.Cardtypes.Actioncard import Actioncard
class Vassal(Actioncard):
EXPENCES = 3
CARDS = 0
ACTIONS = 0
BUYS = 0
MONEY = 2
def specialAction(self, player, game):
card = player.drawAndReturn()
if isinstance(card, Actioncard):
print("playing", card, "wi... | 2.953125 | 3 |
config.py | gzq763199198/xcos_on_cloud | 1 | 55150 | <filename>config.py<gh_stars>1-10
# The location of the extracted scilab_for_xcos_on_cloud. This can be either
# relative to SendLog.py or an absolute path.
SCILAB_DIR = '../scilab_for_xcos_on_cloud'
# The location to keep the flask session data on server.
FLASKSESSIONDIR = '/tmp/flask-sessiondir'
# The location to k... | 2.03125 | 2 |
deliverables/deliverables_3/dashflaskapp/flaskapp/transactions_plotly/dashboard.py | NicholasGoh/real_estate_app | 0 | 55151 | import pandas as pd
import dash
from dash.dependencies import Input, Output
import plotly.express as px
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
# self packages
from .data_generator import load_transactions, comparisons_df
from .nav_bar import nav_b... | 2.671875 | 3 |
app.py | SamedHrmn/image-recommender-flask-api | 2 | 55152 | <filename>app.py
from flask import Flask, render_template, request, json, make_response
from werkzeug.utils import secure_filename
import os
from model_optimized import extract_feature_from_uploaded_image
import base64
from werkzeug.serving import WSGIRequestHandler
from PIL import Image
ROOT_DIR = os.path.dirname(os.... | 2.40625 | 2 |
electronics/gateways/linuxdevice.py | MartijnBraam/pyElectronics | 77 | 55153 | <filename>electronics/gateways/linuxdevice.py<gh_stars>10-100
import smbus
import struct
class LinuxDevice(object):
"""
Class for using a i2c master that is supported by a Linux kernel module. An example is the internal smbus in a
computer motherboard (supported by i2c-dev) or the i2c connection on the Ra... | 3.1875 | 3 |
watcher_dashboard/content/goals/tests.py | openstack/watcher-dashboard | 15 | 55154 | <gh_stars>10-100
# Copyright (c) 2016 b<>com
#
# 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 or agreed to ... | 1.875 | 2 |
np/reference/ch7code/bessel0.py | focusunsink/study_python | 0 | 55155 | <filename>np/reference/ch7code/bessel0.py<gh_stars>0
import numpy as np
from pylab import *
x = np.linspace(0, 4, 100)
vals = np.i0(x)
plot(x, vals)
show()
| 1.890625 | 2 |
tests/func/conftest.py | madtibo/temboard-agent | 0 | 55156 | <filename>tests/func/conftest.py
import pytest
from test.temboard import build_env_dict, drop_env, init_env
ENV = {}
@pytest.fixture(autouse=True, scope='session')
def env():
env = build_env_dict()
drop_env(env)
init_env(env)
ENV.update(env)
try:
yield ENV
finally:
drop_env(... | 1.976563 | 2 |
torrentsearchengine/torrent.py | AlexCovizzi/torrent-search-engine | 4 | 55157 | from .utils import simple_hash
from .torrentbase import TorrentBase
from .torrentdetails import TorrentDetails
class Torrent(TorrentBase):
def fetch_details(self, timeout=30) -> TorrentDetails:
"""
Retrieve details about this torrent (e.g link, description, files...)
Parameters:
... | 3 | 3 |
ThreeBotPackages/tfgrid_solutions/simulator_playground/chatflows/simulator_playground.py | threefoldtech/jumpscaleX_threebot | 0 | 55158 | <gh_stars>0
import time
import uuid
import random
import netaddr
from Jumpscale import j
FARM_ID = 1
DOMAIN = "play.grid.tf"
NETWORK_NAME = "pub.play.grid.tf"
NETWORK = netaddr.IPNetwork("10.40.0.0/16")
FLIST = "https://hub.grid.tf/magidentfinal.3bot/mmotawea-simualtor-latest.flist"
LIFETIME = 6 * 60 * 60
CURRENCY = ... | 1.90625 | 2 |
Scrape/more_detail_genre_scrape.py | better-reads/Data-Science | 0 | 55159 | <filename>Scrape/more_detail_genre_scrape.py
import bs4
import pandas as pd
import requests as r
import re
import traceback
import numpy as np
header = {'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"}
# Save df - Need the hr... | 3.515625 | 4 |
qiwi_api/exceptions.py | Helow19274/qiwi_api | 9 | 55160 | class ApiError(Exception):
pass
class WrongToken(ApiError):
pass
class PermissionError(ApiError):
pass
| 1.398438 | 1 |
source/code/popUpTools/base.py | typesupply/gazoo | 11 | 55161 | import os
from AppKit import NSApp, NSImage
import vanilla
from mojo.UI import CurrentGlyphWindow, UpdateCurrentGlyphView,\
StatusInteractivePopUpWindow
from fontParts.world import CurrentGlyph
resourcesDirectory = os.path.dirname(__file__)
resourcesDirectory = os.path.dirname(resourcesDirectory)
resourcesDirector... | 2.03125 | 2 |
testAPI.py | DarkDisasters/winglets_python | 2 | 55162 | import Winglets
import json
import math
## Prepare Data
dataDict = {}
dataArray = []
f = open('./testFile.json', 'r')
dataDict = json.loads(f.read())
for curKey in dataDict['dots'].keys():
curArrDictData = dataDict['dots'][curKey]
curKeyArr = []
for i in range(len(curArrDictData)):
curKeyArr.appe... | 2.28125 | 2 |
src/test/processors/test_pre_processing.py | hiitsme123/python | 0 | 55163 | import unittest
from programy.processors.pre.toupper import ToUpperPreProcessor
from programy.processors.pre.normalize import NormalizePreProcessor
from programy.bot import Bot
from programy.brain import Brain
from programy.config.brain import BrainConfiguration
from programy.config.bot import BotConfiguration
class ... | 2.78125 | 3 |
consumer/test_consumer.py | astagi/website-monitoring | 1 | 55164 | import os
import time
import datetime
import json
import threading
from consumer import Consumer
from kafka import KafkaProducer
def test_consumer_receives_objects(kafka_admin_client, postgres_client):
(db, db_cur) = postgres_client
db_cur.execute("DELETE FROM website_status;")
db.commit()
kafka_ad... | 2.609375 | 3 |
simian/test/test_patch.py | movermeyer/python-simian | 1 | 55165 | from mock import call
from nose.tools import eq_, raises
from simian import patch
from simian.test.my_package import internal_module
from simian.test.my_package import external_module
def test_patch_with_multiple_arguments():
@patch(
module=internal_module,
external=(
'simian.test.my_p... | 2.296875 | 2 |
dashboard/__init__.py | R-Ramachandran/Impact-of-taxation-on-Indian-economy | 0 | 55166 | <filename>dashboard/__init__.py
from flask import Flask
app = Flask(__name__)
app.config['SECRET_KEY'] = 'fac5f35dc32ba113029dad3eb831d7d1'
from dashboard import routes | 1.625 | 2 |
code-everyday-challenge/n83_lis.py | ved93/deliberate-practice-challenges | 0 | 55167 | <reponame>ved93/deliberate-practice-challenges
def solve(A):
T = [None]*len(A)
prev = [None]*len( A)
for i in range(len(A)):
T[i] = 1
prev[i] = -1
for j in range(i):
if A[j] < A[i] and T[i] < T[j]+1:
T[i] = T[j]+1
return max(T[i] for... | 3.03125 | 3 |
Shell.py | Tanamo-Inc/Python | 0 | 55168 | #
# Shell methods.
#
import os
from os import path
import shutil
from shutil import make_archive
from zipfile import ZipFile
def main():
# Duplicate of an existing file
if path.exists("myFile.txt"):
# get the path to the file in the current directory
src = path.realpath("myFile.txt");
# #... | 3.453125 | 3 |
adventure_game/models/room.py | Def4l71diot/A-Day-in-the-Kremlin | 2 | 55169 | from adventure_game.models.contracts import IRoom
class Room(IRoom):
def __init__(self,
room_id,
name=None,
description=None,
items=None,
exits=None,
puzzles=None):
self._id = room_id
self._name ... | 2.703125 | 3 |
data/parse_messages.py | cherylyli/botlikeme | 0 | 55170 | from bs4 import BeautifulSoup
import json
soup = BeautifulSoup(open("messages.htm"), "lxml")
message_threads = soup.find_all('p')
# get all the messages into an array object
messages = []
for message in message_threads:
messages = messages + message.contents
with open('input.txt', 'w') as fp:
json.dump('\n'.join(... | 2.96875 | 3 |
LAB02/CloudAlbum/run.py | michaelrishiforrester/moving-to-serverless-workshop-1d | 7 | 55171 | <gh_stars>1-10
from flask import Flask, session
from flask_session import Session
from cloudalbum import application as CloudAlbum
from cloudalbum.config import conf
from cloudalbum import util
from redis import StrictRedis
import os, socket
app = Flask(__name__)
# Flask Session for Redis
#app.config['SESSION_TYPE'] ... | 2.1875 | 2 |
aprepi/settings.py | MikaelSantilio/aprepi-django | 0 | 55172 | <reponame>MikaelSantilio/aprepi-django
from pathlib import Path
from datetime import timedelta
import os
import environ
env = environ.Env()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for productio... | 1.859375 | 2 |
check_path.py | ShaneKilloran/ChessEngine | 0 | 55173 | <reponame>ShaneKilloran/ChessEngine<filename>check_path.py
import pickle
import utils
from MiniMax import MiniMax
from Node import Node
pickle_in = open("root.pickle","rb")
root = pickle.load(pickle_in)
mm = MiniMax(root)
mm.minimax(root)
| 2.265625 | 2 |
Chapter05/mnist.py | PacktPublishing/Hands-On-Deep-Learning-for-Images-with-TensorFlow | 16 | 55174 | <filename>Chapter05/mnist.py<gh_stars>10-100
"""
This module serves as the API provider for MNIST digit processing.
"""
import io
import json
import numpy as np
from keras.models import load_model
from PIL import Image
from PIL.ImageOps import fit, grayscale
MNIST_MODEL = load_model('var/data/mnist.h5')
print(MNIST_... | 3.59375 | 4 |
cmit_facepipe.py | ShawnZhang31/facepipe | 1 | 55175 | # 应用脚本
import os
from webapp import create_app
from dotenv import load_dotenv
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
app = create_app(os.getenv("APP_CONFIG") or "production")
| 2.171875 | 2 |
domainbed/scripts/train_uda.py | bismex/DomainBed | 0 | 55176 | <gh_stars>0
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import collections
import json
import os
import random
import sys
import time
import uuid
import ast
import numpy as np
import PIL
import torch
import torchvision
import torch.utils.data
# import torch.multiprocessing
... | 1.960938 | 2 |
tests/test_integration_tha.py | stratasan/s1-python | 0 | 55177 | from s1.parsers import S1Parser
def test_integration_tha(tha_lines, tha_encounter):
parser = S1Parser()
for line in tha_lines:
parser.feed(line)
parser.finish()
records = parser.flush()
assert len(records) == 1
assert records[0].as_dict() == tha_encounter
| 2.40625 | 2 |
train_clean.py | ms03001620/NotMnist | 1 | 55178 | # -*- coding: UTF-8 -*-
import os
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
def show_images(name):
folders = {"A", "b", "c", "d", "e", "f", "g", "h", "i", "j"}
images = []
for folder in folders:
findInFolder = "output/notMNIST_large/" + folder + "/" + name
i... | 2.953125 | 3 |
src/etools_permissions/apps.py | unicef/etools-permissions | 0 | 55179 | from django.apps import AppConfig
class RealmConfig(AppConfig):
name = 'etools_permissions'
| 1.164063 | 1 |
app/puzzle/db/models.py | jyr/cuenca-coding-challenge | 0 | 55180 | from sqlalchemy import Column, String, Integer, Date, literal
try:
from db.driver import Base, Session, engine
except ModuleNotFoundError:
from puzzle.db.driver import Base, Session, engine
class SolutionModel:
def __init__(self, **kwargs):
Base.metadata.create_all(engine)
self.session = ... | 2.5625 | 3 |
tiny_imagenet.py | jmaronas/pytorch_datasets | 3 | 55181 | <filename>tiny_imagenet.py
import torch
import torch.utils.data as data
from scipy.misc import imresize,imsave
from PIL import Image
import os
from common import *
#TODO: return bounding boxes, allow for other types of interpolations
class tiny_ImageNet(ImageFolder):
"""`tiny ImageNet <https://tiny-imagenet.herokuap... | 3 | 3 |
on_demand_eval/speaker.py | openalto/network-simulator-data | 0 | 55182 | #!/usr/bin/env python
import io
import json
from copy import deepcopy
from on_demand_eval.pipeline import Pipeline, Action, ACTION_TYPE, Table, EfficientTable
from on_demand_eval.pipeline import ActionEncoder, ActionDecoder
from on_demand_eval.rule_dg import RuleDependencyGraph
from on_demand_eval.flow_space import F... | 2.078125 | 2 |
dalme_app/utils/domain_middleware.py | DALME/dalme | 6 | 55183 | <reponame>DALME/dalme
from django.http import HttpResponsePermanentRedirect
class SubdomainRedirectMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
host = request.get_host()
if host in ['www.dalme.org', 'public.dalme.org']:
... | 2.40625 | 2 |
simulate_sp500.py | xSakix/rebalancer | 1 | 55184 | import matplotlib.pyplot as plt
import rebalancer
from sp500_data_loader import load_data
import numpy as np
import itertools
import os
from multiprocessing import Process
def interpet_results(assets, rebalance_inv, bah_inv, data, condition, dir):
prices = []
for key in data.keys():
prices.append(data... | 2.203125 | 2 |
rbm/mxnd_rbm.py | yagweb/rbm | 0 | 55185 | <filename>rbm/mxnd_rbm.py
"""
It should be noticed that, the loss definition of mxnet is different from pytorch and tensorflow.
mxnet use Sum while the others use Mean. So the step method of mxnet need a parameter batch_size.
"""
import math
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet import ... | 2.578125 | 3 |
matplotlib/gallery_python/user_interfaces/gtk_spreadsheet_sgskip.py | gottaegbert/penter | 13 | 55186 | """
===============
GTK Spreadsheet
===============
Example of embedding Matplotlib in an application and interacting with a
treeview to store data. Double click on an entry to update plot data.
"""
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk, Gdk
from m... | 3.03125 | 3 |
cli/tests/commands/job/test_run.py | gaybro8777/klio | 705 | 55187 | <filename>cli/tests/commands/job/test_run.py
# Copyright 2019-2020 Spotify AB
#
# 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 requ... | 1.726563 | 2 |
Megaface/align_facescrub.py | SunAriesCN/face-datasets | 0 | 55188 | # coding: utf-8
import cv2
import os,sys
import time
import os.path
import math
sys.path.insert(0, '../facealign')
sys.path.insert(0, '../util')
from fileutil import *
from MtcnnPycaffe import MtcnnDetector, draw_and_show
from alignment import *
from logfile import *
import json
import argparse
def IoU(bbox1, bbo... | 2.265625 | 2 |
lagom/core/utils/__init__.py | lkylych/lagom | 0 | 55189 | <reponame>lkylych/lagom
from lagom.core.utils.logger import Logger | 0.953125 | 1 |
wolframwebengine/examples/aiohttp_application.py | LaudateCorpus1/WolframWebEngineForPython | 59 | 55190 | <reponame>LaudateCorpus1/WolframWebEngineForPython
from __future__ import absolute_import, print_function, unicode_literals
from aiohttp import web
from wolframclient.evaluation import WolframEvaluatorPool
from wolframclient.language import wl
from wolframwebengine.web import aiohttp_wl_view
session = WolframEvaluat... | 2.390625 | 2 |
decrypt_next_level.py | fishilico/sstic-2016 | 0 | 55191 | #!/usr/bin/env python3
"""Decrypt the data needed for the next level"""
import base64
import binascii
import hashlib
import json
import numpy
import sys
from Crypto.Cipher import AES
# x^128 + x^7 + x^2 + x + 1
GCM_POLY = (1 << 128) + (1 << 7) + (1 << 2) + (1 << 1) + (1 << 0)
def invert_poly(p):
"""Invert the gi... | 3.328125 | 3 |
src/priority_selector.py | moibenko/enstore | 4 | 55192 | #!/usr/bin/env python
###############################################################################
# $Id$
#
# system imports
import sys
import os
import stat
import errno
import string
import re
#import pcre has been deprecated
import copy
import traceback
import e_errors
import Trace
MAX_REG_PRIORITY = 1000001
c... | 2.015625 | 2 |
Ska/engarchive/fix_bad_values.py | jmodelcxc/eng_archive | 0 | 55193 | <reponame>jmodelcxc/eng_archive
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Fix bad values that are in the engineering archive.
Typically this is needed because of bad telemetry that is not marked
as such in the CXC archive. This code will mark a single value or
range of values as bad (via th... | 1.890625 | 2 |
Aulas/Mundo 3/101.py | JoaoEmanuell/Meus-Estudos-Python | 2 | 55194 | def ano(n=0):
from datetime import date#ao fazer a importação somente durante a execução da função, vc economiza memoria
idade = date.today().year - n
if idade >= 18 and idade <= 70:
return (f'Com {idade} anos o voto é \033[1:31mOBRIGATORIO\033[m')
if idade >= 16 and idade <= 17 or idade >=... | 3.796875 | 4 |
generate.py | Tori-San/fractalStuff | 0 | 55195 | <filename>generate.py
import time
from random import random
from utils import pr
MaxIter = 10 ** 4
NumPoints = 10 ** 7
def iterate(c):
z = 0
l = []
for i in range(MaxIter):
if abs(z) > 2:
return l
l += [(z, i)]
z = z ** 2 + c # Buddhabrot
# z = z ** 2 - z + c ... | 3.03125 | 3 |
main.py | BateauNautilus/drivesimulator | 1 | 55196 | #!/usr/bin/env python3
import time
from Message.CANMessage import MessageToCan
from Message.EnvironmentStatus import EnvironmentStatus
from Message.MotorStatus import MotorStatus
from Message.Parameters.Current import Current
from Message.Parameters.Humidity import Humidity
from Message.Parameters.Vibration import Vibr... | 2.375 | 2 |
agent/indy_catalyst_agent/messaging/proofs/messages/proof_request.py | TelegramSam/indy-catalyst | 0 | 55197 | <gh_stars>0
"""
A proof request content message.
"""
from marshmallow import Schema, fields, post_load
from ...agent_message import AgentMessage
from ...message_types import MessageTypes
class ProofRequest(AgentMessage):
def __init__(self, proof_request_json: str):
self.proof_request_json = proof_reques... | 2.21875 | 2 |
application/dash_application/tcpdump.py | ckljohn/dash-live-table | 0 | 55198 | """Create a Dash app within a Flask app."""
import os
import json
import dash
import dash_table
# from dash_table.Format import Format, Scheme
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_core_components as dcc
# from .layout import html_layout
from application.utils.es im... | 2.953125 | 3 |
src/pyscaffoldext/nox/extension.py | SarthakJariwala/pyscaffoldext-nox | 0 | 55199 | <filename>src/pyscaffoldext/nox/extension.py<gh_stars>0
# -*- coding: utf-8 -*-
"""Implementation to add noxfile.py to
PyScaffold project
"""
from pathlib import PurePath
from pyscaffold.api import Extension, helpers
from .templates import noxfile
class Nox(Extension):
"""
Generate Nox configuration file fo... | 2.484375 | 2 |