max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
02-static-templates-files/02_html_template.py | saidulislam/flask-bootcamp-2 | 0 | 1300 | <filename>02-static-templates-files/02_html_template.py
from flask import Flask,
app = Flask(__name__)
@app.route("/")
def homepage():
return "Paws Rescue Center 🐾"
@app.route("/about")
def about():
return """We are a non-profit organization working as an animal rescue center.
We aim to help ... | <filename>02-static-templates-files/02_html_template.py
from flask import Flask,
app = Flask(__name__)
@app.route("/")
def homepage():
return "Paws Rescue Center 🐾"
@app.route("/about")
def about():
return """We are a non-profit organization working as an animal rescue center.
We aim to help ... | en | 0.978345 | We are a non-profit organization working as an animal rescue center.
We aim to help you connect with purrfect furbaby for you!
The animals you find at our website are rescue animals which have been rehabilitated.
Our mission is to promote the ideology of "Adopt, don't Shop"! | 2.66368 | 3 |
src/compas/datastructures/mesh/bbox.py | arpastrana/compas | 2 | 1301 | <reponame>arpastrana/compas
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import bounding_box
from compas.geometry import bounding_box_xy
__all__ = [
'mesh_bounding_box',
'mesh_bounding_box_xy',
]
def mesh_bounding_box(mes... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import bounding_box
from compas.geometry import bounding_box_xy
__all__ = [
'mesh_bounding_box',
'mesh_bounding_box_xy',
]
def mesh_bounding_box(mesh):
"""Compute the (axis... | en | 0.385695 | Compute the (axis aligned) bounding box of a mesh. Parameters ---------- mesh : compas.datastructures.Mesh The mesh data structure. Returns ------- list of point The 8 corners of the bounding box of the mesh. Examples -------- >>> mesh_bounding_box(mesh) [[0.0,... | 2.668245 | 3 |
crop/source_selection/__init__.py | Lars-H/federated_crop | 0 | 1302 | from naive import NaiveSourceSelection
from star_based import StarBasedSourceSelection
from utils import AskSourceSelector, HybridSourceSelector, StatSourceSelector
from charset_selector import CharSet_Selector | from naive import NaiveSourceSelection
from star_based import StarBasedSourceSelection
from utils import AskSourceSelector, HybridSourceSelector, StatSourceSelector
from charset_selector import CharSet_Selector | none | 1 | 0.996555 | 1 | |
base3_plus.py | Mhaiyang/iccv | 2 | 1303 | """
@Time : 201/21/19 10:47
@Author : TaylorMei
@Email : <EMAIL>
@Project : iccv
@File : base3_plus.py
@Function:
""" | """
@Time : 201/21/19 10:47
@Author : TaylorMei
@Email : <EMAIL>
@Project : iccv
@File : base3_plus.py
@Function:
""" | fr | 0.388555 | @Time : 201/21/19 10:47 @Author : TaylorMei @Email : <EMAIL> @Project : iccv @File : base3_plus.py @Function: | 0.840212 | 1 |
visnav/algo/orig/tools.py | oknuutti/hw_visnav | 0 | 1304 | <filename>visnav/algo/orig/tools.py<gh_stars>0
import math
import time
import numpy as np
import numba as nb
import quaternion # adds to numpy # noqa # pylint: disable=unused-import
import sys
import scipy
from astropy.coordinates import SkyCoord
from scipy.interpolate import RectBivariateSpline
from scipy.interpol... | <filename>visnav/algo/orig/tools.py<gh_stars>0
import math
import time
import numpy as np
import numba as nb
import quaternion # adds to numpy # noqa # pylint: disable=unused-import
import sys
import scipy
from astropy.coordinates import SkyCoord
from scipy.interpolate import RectBivariateSpline
from scipy.interpol... | en | 0.651847 | # adds to numpy # noqa # pylint: disable=unused-import # from scipy.spatial.ckdtree import cKDTree # from https://www.safaribooksonline.com/library/view/python-cookbook-3rd/9781449357337/ch13s13.html A: array of vectors, b: axis vector A: point, B: vector # (length of b)**2 # a dot b vector product (project a on b but... | 2.067357 | 2 |
cirtorch/filters/sobel.py | Tarekbouamer/Image-Retrieval-for-Image-Based-Localization | 3 | 1305 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .kernels import (
get_spatial_gradient_kernel2d,
get_spatial_gradient_kernel3d,
normalize_kernel2d
)
def spatial_gradient(input, mode='sobel', order=1, normalized=True):
"""
Computes the first order image derivative in bo... | import torch
import torch.nn as nn
import torch.nn.functional as F
from .kernels import (
get_spatial_gradient_kernel2d,
get_spatial_gradient_kernel3d,
normalize_kernel2d
)
def spatial_gradient(input, mode='sobel', order=1, normalized=True):
"""
Computes the first order image derivative in bo... | en | 0.825801 | Computes the first order image derivative in both x and y using a Sobel operator. # allocate kernel # prepare kernel # convolve input tensor with sobel kernel # Pad with "replicate for spatial dims, but with zeros for channel Computes the first and second order volume derivative in x, y and d using a diff operator. # a... | 2.695693 | 3 |
PythonCookbook/concurrent_test/findrobots.py | xu6148152/Binea_Python_Project | 0 | 1306 | <filename>PythonCookbook/concurrent_test/findrobots.py
# -*- encoding: utf-8 -*-
import gzip
import io
import glob
from concurrent import futures
def find_robots(filename):
'''
Find all of the hosts that access robots.txt in a single log file
'''
robots = set()
with gzip.open(filename) as f:
... | <filename>PythonCookbook/concurrent_test/findrobots.py
# -*- encoding: utf-8 -*-
import gzip
import io
import glob
from concurrent import futures
def find_robots(filename):
'''
Find all of the hosts that access robots.txt in a single log file
'''
robots = set()
with gzip.open(filename) as f:
... | en | 0.935083 | # -*- encoding: utf-8 -*- Find all of the hosts that access robots.txt in a single log file Find all hosts across and entire sequence of files | 2.773098 | 3 |
docker/setup.py | sreynit02/RunestoneServer | 0 | 1307 | # ******************************************************************
# |docname| - Provide `docker_tools.py` as the script `docker-tools`
# ******************************************************************
from setuptools import setup
setup(
name="runestone-docker-tools",
version="0.1",
install_requires=[... | # ******************************************************************
# |docname| - Provide `docker_tools.py` as the script `docker-tools`
# ******************************************************************
from setuptools import setup
setup(
name="runestone-docker-tools",
version="0.1",
install_requires=[... | en | 0.297562 | # ****************************************************************** # |docname| - Provide `docker_tools.py` as the script `docker-tools` # ****************************************************************** | 1.350211 | 1 |
PS12/api2.py | AbhinavSingh-21f1002369/AFKZenCoders | 0 | 1308 | <reponame>AbhinavSingh-21f1002369/AFKZenCoders<filename>PS12/api2.py
from flask import Flask, render_template, request, jsonify,send_file, redirect,session, url_for
from werkzeug import secure_filename
import os
import utilities, queries
import logger
from flask_cors import CORS, cross_origin
from datetime import timed... | from flask import Flask, render_template, request, jsonify,send_file, redirect,session, url_for
from werkzeug import secure_filename
import os
import utilities, queries
import logger
from flask_cors import CORS, cross_origin
from datetime import timedelta
app = Flask(__name__)
CORS(app)
cors = CORS(app, resources={r"/*... | en | 0.555154 | #number = request.args.get('number') #number = "7982345234" #print(uploaded_files) # print(path,file,filename) # /home/pi/Desktop/AFKZenCoders/PS12/uploads/Thana_list_UP.csv <FileStorage: 'Thana_list_UP.csv' ('application/vnd.ms-excel')> Thana_list_UP.csv # Getting the File # Path for file # Saving File # Loading File ... | 2.310107 | 2 |
cnnblstm_with_adabn/cnnblstm_with_adabn.py | Fassial/Air-Writing-with-TL | 1 | 1309 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
# local model
import sys
sys.path.append("../network")
import Coral
from lstm import LSTMHardSigmoid
from AdaBN import AdaBN
sys.path.append("../network/Aut... | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
# local model
import sys
sys.path.append("../network")
import Coral
from lstm import LSTMHardSigmoid
from AdaBN import AdaBN
sys.path.append("../network/Aut... | en | 0.499591 | # local model # 150 # self.ae = AutoEncoder.load_AE(type = "ConvAE", time_steps = self.time_steps, n_features = self.n_features, use_cuda = self.use_cuda, params_pkl = os.path.join(self.params_dir, cnnblstm_with_adabn.PARAMS_AE)) # build net1 cnn # nn.Conv1d(in_channels = self.ae.n_filters3, out_channels = self.n_filte... | 2.42518 | 2 |
src/emmental/model.py | woffett/emmental | 0 | 1310 | <filename>src/emmental/model.py
"""Emmental model."""
import itertools
import logging
import os
from collections import defaultdict
from collections.abc import Iterable
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import numpy as np
import torch
from numpy import ndarray
from torch import ... | <filename>src/emmental/model.py
"""Emmental model."""
import itertools
import logging
import os
from collections import defaultdict
from collections.abc import Iterable
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import numpy as np
import torch
from numpy import ndarray
from torch import ... | en | 0.684304 | Emmental model. A class to build multi-task model. Args: name: Name of the model, defaults to None. tasks: A task or a list of tasks. Initialize EmmentalModel. # Initiate the model attributes # TODO: make it concrete # Build network with given tasks # Move model to specified device Move model to specif... | 2.2493 | 2 |
server/ws_server.py | jangxx/OVRT_Soundpad | 1 | 1311 | import asyncio, json
from config import Config
from soundpad_manager import SoundpadManager
from version import BRIDGE_VERSION
import websockets
from sanic.log import logger
# yes I know that it's very lazy to run a separate WS and HTTP server, when both could be run on the same port
# I don't like sanics ... | import asyncio, json
from config import Config
from soundpad_manager import SoundpadManager
from version import BRIDGE_VERSION
import websockets
from sanic.log import logger
# yes I know that it's very lazy to run a separate WS and HTTP server, when both could be run on the same port
# I don't like sanics ... | en | 0.929876 | # yes I know that it's very lazy to run a separate WS and HTTP server, when both could be run on the same port # I don't like sanics WS implementation tho and this is just a quick and dirty project anyway, so there is no reason to get all that fancy # ephemeral state # invalid values are not allowed # out of bounds # i... | 2.524155 | 3 |
tests/route_generator_test.py | CityPulse/dynamic-bus-scheduling | 14 | 1312 | <gh_stars>10-100
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
- LICENCE
The MIT License (MIT)
Copyright (c) 2016 <NAME> Ericsson AB (EU FP7 CityPulse Project)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to d... | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
- LICENCE
The MIT License (MIT)
Copyright (c) 2016 <NAME> Ericsson AB (EU FP7 CityPulse Project)
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 Softwa... | en | 0.091088 | #!/usr/local/bin/python # -*- coding: utf-8 -*- - LICENCE The MIT License (MIT) Copyright (c) 2016 <NAME> Ericsson AB (EU FP7 CityPulse Project) 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 w... | 1.335478 | 1 |
tensorforce/tests/test_model_save_restore.py | gian1312/suchen | 0 | 1313 | <reponame>gian1312/suchen
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import unittest
import pytest
from tensorforce import TensorForceError
from tensorforce.core.networks import LayeredNetwork
from tensorforce.models import DistributionModel
from tenso... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import unittest
import pytest
from tensorforce import TensorForceError
from tensorforce.core.networks import LayeredNetwork
from tensorforce.models import DistributionModel
from tensorforce.tests.minimal_test ... | en | 0.872146 | Minimal implementation of a Network that can be saved and restored independently of the Model. Test to validate that calls to save and restore of a SavableComponent successfully save and restore the component's state. # Ensure only the network variables are loaded Simulates training outside of Tensorforce and t... | 2.035526 | 2 |
guid.py | lihuiba/SoftSAN | 1 | 1314 | <reponame>lihuiba/SoftSAN
import random
import messages_pb2 as msg
def assign(x, y):
x.a=y.a; x.b=y.b; x.c=y.c; x.d=y.d
def isZero(x):
return (x.a==0 and x.b==0 and x.c==0 and x.d==0)
def setZero(x):
x.a=0; x.b=0; x.c=0; x.d=0
def toStr(x):
return "%08x-%08x-%08x-%08x" % (x.a, x.b, x.c, x.d)
def to... | import random
import messages_pb2 as msg
def assign(x, y):
x.a=y.a; x.b=y.b; x.c=y.c; x.d=y.d
def isZero(x):
return (x.a==0 and x.b==0 and x.c==0 and x.d==0)
def setZero(x):
x.a=0; x.b=0; x.c=0; x.d=0
def toStr(x):
return "%08x-%08x-%08x-%08x" % (x.a, x.b, x.c, x.d)
def toTuple(x):
return (x.a,... | none | 1 | 2.591439 | 3 | |
mango/__init__.py | kronael/mango-explorer | 0 | 1315 | <filename>mango/__init__.py
# In --strict mode, mypy complains about imports unless they're done this way.
#
# It complains 'Module has no attribute ABC' or 'Module "mango" does not explicitly export
# attribute "XYZ"; implicit reexport disabled'. We could dial that back by using the
# --implicit-reexport parameter, bu... | <filename>mango/__init__.py
# In --strict mode, mypy complains about imports unless they're done this way.
#
# It complains 'Module has no attribute ABC' or 'Module "mango" does not explicitly export
# attribute "XYZ"; implicit reexport disabled'. We could dial that back by using the
# --implicit-reexport parameter, bu... | en | 0.814715 | # In --strict mode, mypy complains about imports unless they're done this way. # # It complains 'Module has no attribute ABC' or 'Module "mango" does not explicitly export # attribute "XYZ"; implicit reexport disabled'. We could dial that back by using the # --implicit-reexport parameter, but let's keep things strict. ... | 1.935463 | 2 |
letters_of_sherlock.py | MariannaJan/LettersOfSherlock | 0 | 1316 | <filename>letters_of_sherlock.py
import lettercounter as lc
#Books form Gutenberg Project: https://www.gutenberg.org/ebooks/author/69
lc.showPlots(text_directory_pathname="./Books/",
title="<NAME>'s favourite letters",
legend_label_main="in Doyle's stories") | <filename>letters_of_sherlock.py
import lettercounter as lc
#Books form Gutenberg Project: https://www.gutenberg.org/ebooks/author/69
lc.showPlots(text_directory_pathname="./Books/",
title="<NAME>'s favourite letters",
legend_label_main="in Doyle's stories") | en | 0.590193 | #Books form Gutenberg Project: https://www.gutenberg.org/ebooks/author/69 | 2.487128 | 2 |
BB/bbObjects/items/bbTurret.py | mwaitzman/GOF2BountyBot | 0 | 1317 | from .bbItem import bbItem
from ...bbConfig import bbData
class bbTurret(bbItem):
dps = 0.0
def __init__(self, name, aliases, dps=0.0, value=0, wiki="", manufacturer="", icon="", emoji=""):
super(bbTurret, self).__init__(name, aliases, value=value, wiki=wiki, manufacturer=manufacturer, icon=icon, emoj... | from .bbItem import bbItem
from ...bbConfig import bbData
class bbTurret(bbItem):
dps = 0.0
def __init__(self, name, aliases, dps=0.0, value=0, wiki="", manufacturer="", icon="", emoji=""):
super(bbTurret, self).__init__(name, aliases, value=value, wiki=wiki, manufacturer=manufacturer, icon=icon, emoj... | none | 1 | 2.530859 | 3 | |
what_can_i_cook/urls.py | s-maibuecher/what_can_i_cook | 0 | 1318 | from django.urls import path
from what_can_i_cook.views import WCICFilterView, WCICResultView
app_name = "wcic"
urlpatterns = [
path("", WCICFilterView.as_view(), name="wcic-start"),
path("results/", WCICResultView.as_view(), name="wcic-results"),
]
| from django.urls import path
from what_can_i_cook.views import WCICFilterView, WCICResultView
app_name = "wcic"
urlpatterns = [
path("", WCICFilterView.as_view(), name="wcic-start"),
path("results/", WCICResultView.as_view(), name="wcic-results"),
]
| none | 1 | 1.629474 | 2 | |
shared/templates/grub2_bootloader_argument/template.py | justchris1/scap-security-guide | 1,138 | 1319 | import ssg.utils
def preprocess(data, lang):
data["arg_name_value"] = data["arg_name"] + "=" + data["arg_value"]
if lang == "oval":
# escape dot, this is used in oval regex
data["escaped_arg_name_value"] = data["arg_name_value"].replace(".", "\\.")
# replace . with _, this is used in t... | import ssg.utils
def preprocess(data, lang):
data["arg_name_value"] = data["arg_name"] + "=" + data["arg_value"]
if lang == "oval":
# escape dot, this is used in oval regex
data["escaped_arg_name_value"] = data["arg_name_value"].replace(".", "\\.")
# replace . with _, this is used in t... | en | 0.848891 | # escape dot, this is used in oval regex # replace . with _, this is used in test / object / state ids | 2.669317 | 3 |
preprocess.py | NNDEV1/NMTWithLuongAttention | 4 | 1320 | <filename>preprocess.py<gh_stars>1-10
import tensorflow as tf
import os
import contractions
import tensorflow as tf
import pandas as pd
import numpy as np
import time
import rich
from rich.progress import track
import spacy
from config import params
#Preprocessing Text
class preprocess_text():
def __init__(self... | <filename>preprocess.py<gh_stars>1-10
import tensorflow as tf
import os
import contractions
import tensorflow as tf
import pandas as pd
import numpy as np
import time
import rich
from rich.progress import track
import spacy
from config import params
#Preprocessing Text
class preprocess_text():
def __init__(self... | en | 0.423471 | #Preprocessing Text | 2.552476 | 3 |
setup.py | johannesulf/dsigma | 4 | 1321 | from setuptools import setup, find_packages
from distutils.extension import Extension
from distutils.command.sdist import sdist
try:
from Cython.Build import cythonize
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
ext = 'pyx' if USE_CYTHON else 'c'
extensions = [Extension(
'dsigma.precomput... | from setuptools import setup, find_packages
from distutils.extension import Extension
from distutils.command.sdist import sdist
try:
from Cython.Build import cythonize
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
ext = 'pyx' if USE_CYTHON else 'c'
extensions = [Extension(
'dsigma.precomput... | none | 1 | 1.734575 | 2 | |
face_detector/modules/mod_faceDetection.py | jtfan3/face_detection | 0 | 1322 | import cv2
import mediapipe as mp
class FaceDetection():
# initialize the face detection class with arguments from https://google.github.io/mediapipe/solutions/face_detection.html
def __init__(self, model_selection = 0, threshold = 0.5):
self.model_selection = model_selection
self.threshold = t... | import cv2
import mediapipe as mp
class FaceDetection():
# initialize the face detection class with arguments from https://google.github.io/mediapipe/solutions/face_detection.html
def __init__(self, model_selection = 0, threshold = 0.5):
self.model_selection = model_selection
self.threshold = t... | en | 0.571381 | # initialize the face detection class with arguments from https://google.github.io/mediapipe/solutions/face_detection.html # gets bounding boxes using self.face_detection, returns a list of element, elment = (score, bbox_dict) # draws the bbox onto the frame # prepare text, depending on what atributes we predict # draw... | 3.20297 | 3 |
backend/0_publish_audio.py | bmj-hackathon/ethberlinzwei-babelfish_3_0 | 1 | 1323 | <filename>backend/0_publish_audio.py
import sys
import logging
# loggers_dict = logging.Logger.manager.loggerDict
#
# logger = logging.getLogger()
# logger.handlers = []
#
# # Set level
# logger.setLevel(logging.DEBUG)
#
# # FORMAT = "%(asctime)s - %(levelno)s - %(module)-15s - %(funcName)-15s - %(message)s"
# # FORMA... | <filename>backend/0_publish_audio.py
import sys
import logging
# loggers_dict = logging.Logger.manager.loggerDict
#
# logger = logging.getLogger()
# logger.handlers = []
#
# # Set level
# logger.setLevel(logging.DEBUG)
#
# # FORMAT = "%(asctime)s - %(levelno)s - %(module)-15s - %(funcName)-15s - %(message)s"
# # FORMA... | en | 0.432453 | # loggers_dict = logging.Logger.manager.loggerDict # # logger = logging.getLogger() # logger.handlers = [] # # # Set level # logger.setLevel(logging.DEBUG) # # # FORMAT = "%(asctime)s - %(levelno)s - %(module)-15s - %(funcName)-15s - %(message)s" # # FORMAT = "%(asctime)s %(levelno)s: %(module)30s %(message)s" # FORMAT... | 1.99149 | 2 |
src/pyRofex/components/messages.py | guillerminaamorin/pyRofex | 2 | 1324 | # -*- coding: utf-8 -*-
"""
pyRofex.components.messages
Defines APIs messages templates
"""
# Template for a Market Data Subscription message
MARKET_DATA_SUBSCRIPTION = '{{"type":"smd","level":1, "entries":[{entries}],"products":[{symbols}]}}'
# Template for an Order Subscription message
ORDER_SUBSCRIPTION = ... | # -*- coding: utf-8 -*-
"""
pyRofex.components.messages
Defines APIs messages templates
"""
# Template for a Market Data Subscription message
MARKET_DATA_SUBSCRIPTION = '{{"type":"smd","level":1, "entries":[{entries}],"products":[{symbols}]}}'
# Template for an Order Subscription message
ORDER_SUBSCRIPTION = ... | en | 0.345982 | # -*- coding: utf-8 -*- pyRofex.components.messages Defines APIs messages templates # Template for a Market Data Subscription message # Template for an Order Subscription message # Template to specify an instrument in a market data subscription message # Template to insert a Double Quote | 1.516972 | 2 |
course/task_6/flask_app.py | duboviy/async | 6 | 1325 | #!/usr/bin/env python3.4
from flask import Flask
import requests
from fibonacci import fibonacci as fib
app = Flask(__name__)
@app.route('/count/<key>')
def count(key):
return requests.get('http://127.0.0.1:8080/count/{}'.format(key)).text
@app.route('/fibonacci/<n>')
def fibonacci(n):
return str(fib(int(... | #!/usr/bin/env python3.4
from flask import Flask
import requests
from fibonacci import fibonacci as fib
app = Flask(__name__)
@app.route('/count/<key>')
def count(key):
return requests.get('http://127.0.0.1:8080/count/{}'.format(key)).text
@app.route('/fibonacci/<n>')
def fibonacci(n):
return str(fib(int(... | en | 0.163579 | #!/usr/bin/env python3.4 | 3.032713 | 3 |
nexpose/nexpose_vulnerabilityexception.py | Patralos/nexpose-client-python | 29 | 1326 | <gh_stars>10-100
# Future Imports for py2/3 backwards compat.
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from builtins import object
from .xml_utils import get_attribute, get_content_of
from future import standard_library
standard_library.install_aliases... | # Future Imports for py2/3 backwards compat.
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from builtins import object
from .xml_utils import get_attribute, get_content_of
from future import standard_library
standard_library.install_aliases()
def fix_null... | en | 0.540011 | # Future Imports for py2/3 backwards compat. # This state is also used for recalled exceptions! # TODO: date object # TODO: date object # TODO: date object # TODO: date object | 2.157737 | 2 |
myproject/IND_Project/backend/signup/apps.py | captainTOKIO/Premchand_Aug2022_fullstack_august_python1 | 4 | 1327 | from django.apps import AppConfig
class SignupConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'signup'
| from django.apps import AppConfig
class SignupConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'signup'
| none | 1 | 1.354094 | 1 | |
pymc/mc_enum.py | cherish-web/pymc | 4 | 1328 | <gh_stars>1-10
# _*_ coding: utf-8 _*_
# @Time : 2021/3/29 上午 08:57
# @Author : cherish_peng
# @Email : <EMAIL>
# @File : cmd.py
# @Software : PyCharm
from enum import Enum
class EnumSubTitle(Enum):
Request4e = 0x5400
# 请求
Request = 0x5000
# 应答
Respond = 0xD000
Respond4e = 0xD400
class Enu... | # _*_ coding: utf-8 _*_
# @Time : 2021/3/29 上午 08:57
# @Author : cherish_peng
# @Email : <EMAIL>
# @File : cmd.py
# @Software : PyCharm
from enum import Enum
class EnumSubTitle(Enum):
Request4e = 0x5400
# 请求
Request = 0x5000
# 应答
Respond = 0xD000
Respond4e = 0xD400
class EnumEndCode(Enum):... | zh | 0.788212 | # _*_ coding: utf-8 _*_ # @Time : 2021/3/29 上午 08:57 # @Author : cherish_peng # @Email : <EMAIL> # @File : cmd.py # @Software : PyCharm # 请求 # 应答 # 正常应答 # 异常应答 # 成批读 # 成批写 # 有存储扩展模块b7=0,b6=0:随机读出,监视数据注册用外 # 按位读写 # 按字读写 # 有存储扩展模块b7=1,b6=0:随机读出,监视数据注册用外 # 按位读写 # 按字读写 # 位类型 # 字类型 | 2.451994 | 2 |
py/sentry_data_schemas/__init__.py | getsentry/sentry-data-schemas | 7 | 1329 | from importlib.resources import path
from jsonschema_typed import JSONSchema
with path("sentry_data_schemas", "event.schema.json") as schema_path:
EventData = JSONSchema["var:sentry_data_schemas:schema_path"]
| from importlib.resources import path
from jsonschema_typed import JSONSchema
with path("sentry_data_schemas", "event.schema.json") as schema_path:
EventData = JSONSchema["var:sentry_data_schemas:schema_path"]
| none | 1 | 1.79302 | 2 | |
predict.py | faroit/deep-fireball | 0 | 1330 | <gh_stars>0
# elsewhere...
import pandas as pd
from keras.models import model_from_json
import random
import sys
import numpy as np
maxlen = 15
step = 3
df = pd.read_pickle('articles.pandas')
text = str.join(' ', df.text.tolist())
chars = set(text)
print('total chars:', len(chars))
char_indices = dict((c, i) for i,... | # elsewhere...
import pandas as pd
from keras.models import model_from_json
import random
import sys
import numpy as np
maxlen = 15
step = 3
df = pd.read_pickle('articles.pandas')
text = str.join(' ', df.text.tolist())
chars = set(text)
print('total chars:', len(chars))
char_indices = dict((c, i) for i, c in enumer... | en | 0.720631 | # elsewhere... # helper function to sample an index from a probability array | 2.689745 | 3 |
tests/simulation/test_container.py | Zavioer/SIR-simulation-IBM-ESI | 0 | 1331 | <filename>tests/simulation/test_container.py
import unittest
from simulation import container
from simulation import person
class ContainerTestCase(unittest.TestCase):
def setUp(self) -> None:
self.box = container.Container(100, 1000, 300, 1, 0.5)
self.s_instance = person.Person(x=0, y=0, infectio... | <filename>tests/simulation/test_container.py
import unittest
from simulation import container
from simulation import person
class ContainerTestCase(unittest.TestCase):
def setUp(self) -> None:
self.box = container.Container(100, 1000, 300, 1, 0.5)
self.s_instance = person.Person(x=0, y=0, infectio... | none | 1 | 3.517453 | 4 | |
pontoon/base/migrations/0007_auto_20150710_0944.py | Tratty/pontoon | 3 | 1332 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import pontoon.base.models
class Migration(migrations.Migration):
dependencies = [
("base", "0006_auto_20150602_0616"),
]
operations = [
migrations.AddField(
model_name="... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import pontoon.base.models
class Migration(migrations.Migration):
dependencies = [
("base", "0006_auto_20150602_0616"),
]
operations = [
migrations.AddField(
model_name="... | en | 0.769321 | # -*- coding: utf-8 -*- | 1.728305 | 2 |
platformio/project/commands/init.py | ufo2011/platformio-core | 0 | 1333 | # Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# 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 ag... | # Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# 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 ag... | en | 0.825149 | # Copyright (c) 2014-present PlatformIO <<EMAIL>> # # 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 ag... | 1.937811 | 2 |
12_module_release/message/__init__.py | DeveloperLY/Python-practice | 0 | 1334 | <filename>12_module_release/message/__init__.py
from . import send_message
from . import receive_message | <filename>12_module_release/message/__init__.py
from . import send_message
from . import receive_message | none | 1 | 1.063529 | 1 | |
guardian/decorators.py | peopledoc/django-guardian | 0 | 1335 | <reponame>peopledoc/django-guardian<filename>guardian/decorators.py
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.utils.functional import wraps
from ... | from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.utils.functional import wraps
from django.utils.http import urlquote
from django.db.models import Model... | en | 0.68647 | Decorator for views that checks whether a user has a particular permission enabled. Optionally, instances for which check should be made may be passed as an second argument or as a tuple parameters same as those passed to ``get_object_or_404`` but must be provided as pairs of strings. :param login... | 2.20022 | 2 |
images/forms.py | mpgarate/OST-fauxra | 1 | 1336 | <filename>images/forms.py
from django import forms
from django.forms import ModelForm
from images.models import Image
class ImageForm(ModelForm):
class Meta:
model = Image
| <filename>images/forms.py
from django import forms
from django.forms import ModelForm
from images.models import Image
class ImageForm(ModelForm):
class Meta:
model = Image
| none | 1 | 1.670086 | 2 | |
WebIOPi-0.7.1/python/webiopi/devices/analog/__init__.py | MORIMOTO520212/Arm-crawler | 1 | 1337 | <gh_stars>1-10
# Copyright 2012-2013 <NAME> - trouch.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 ... | # Copyright 2012-2013 <NAME> - trouch.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 ... | en | 0.826387 | # Copyright 2012-2013 <NAME> - trouch.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 ... | 2.147087 | 2 |
osc_choochoo/tests/v1/test_train.py | dtroyer/osc-loco | 1 | 1338 | # Copyright 2013 Nebula Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | # Copyright 2013 Nebula Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | en | 0.80145 | # Copyright 2013 Nebula Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to... | 1.95383 | 2 |
scripts/firefox-wrapper.py | darioncassel/OmniCrawl | 2 | 1339 | #!/usr/bin/env python3
import sys
from os.path import dirname, abspath, join
import subprocess
# Note this does not resolve symbolic links
# https://stackoverflow.com/a/17806123
FIREFOX_BINARY = join(dirname(abspath(__file__)), 'firefox')
argvs = list(sys.argv)
argvs[0] = FIREFOX_BINARY
# geckdriver will run `firef... | #!/usr/bin/env python3
import sys
from os.path import dirname, abspath, join
import subprocess
# Note this does not resolve symbolic links
# https://stackoverflow.com/a/17806123
FIREFOX_BINARY = join(dirname(abspath(__file__)), 'firefox')
argvs = list(sys.argv)
argvs[0] = FIREFOX_BINARY
# geckdriver will run `firef... | en | 0.619999 | #!/usr/bin/env python3 # Note this does not resolve symbolic links # https://stackoverflow.com/a/17806123 # geckdriver will run `firefox -version` first to check the version # First search for the -tmpprofile option # If it's present, replace profile with tmp_profile # Firefox will ignore the -tmpprofile option | 2.283931 | 2 |
src/pretix/base/payment.py | whiteyhat/pretix | 0 | 1340 | import json
import logging
from collections import OrderedDict
from decimal import ROUND_HALF_UP, Decimal
from typing import Any, Dict, Union
import pytz
from django import forms
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.dispatch import receiver
from django.fo... | import json
import logging
from collections import OrderedDict
from decimal import ROUND_HALF_UP, Decimal
from typing import Any, Dict, Union
import pytz
from django import forms
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.dispatch import receiver
from django.fo... | en | 0.86038 | This is the base class for all payment providers. # Default values Returns whether or whether not this payment provider is an "implicit" payment provider that will *always* and unconditionally be used if is_allowed() returns True and does not require any input. This is intended to be used by the FreePa... | 1.762011 | 2 |
tests/AssertFail/run.py | sag-tgo/EPL_assert_demo | 0 | 1341 | <filename>tests/AssertFail/run.py
from pysys.basetest import BaseTest
from apama.correlator import CorrelatorHelper
import os
class PySysTest(BaseTest):
def execute(self):
corr = CorrelatorHelper(self, name='correlator')
corr.start(logfile='correlator.log')
corr.injectEPL(os.getenv('APAMA_HOME','') + '/monitors... | <filename>tests/AssertFail/run.py
from pysys.basetest import BaseTest
from apama.correlator import CorrelatorHelper
import os
class PySysTest(BaseTest):
def execute(self):
corr = CorrelatorHelper(self, name='correlator')
corr.start(logfile='correlator.log')
corr.injectEPL(os.getenv('APAMA_HOME','') + '/monitors... | none | 1 | 2.133594 | 2 | |
src/beast/python/beast/env/ReadEnvFile_test.py | Ziftr/stellard | 58 | 1342 | from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
from beast.env.ReadEnvFile import read_env_file
from beast.util import Terminal
Terminal.CAN_CHANGE_COLOR = False
JSON = """
{
"FOO": "foo",
"BAR": "bar bar bar",
"CPPFLAGS": "-std=c++11 -frtti -fno... | from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
from beast.env.ReadEnvFile import read_env_file
from beast.util import Terminal
Terminal.CAN_CHANGE_COLOR = False
JSON = """
{
"FOO": "foo",
"BAR": "bar bar bar",
"CPPFLAGS": "-std=c++11 -frtti -fno... | en | 0.499143 | { "FOO": "foo", "BAR": "bar bar bar", "CPPFLAGS": "-std=c++11 -frtti -fno-strict-aliasing -DWOMBAT" } # An env file. FOO=foo export BAR="bar bar bar" CPPFLAGS=-std=c++11 -frtti -fno-strict-aliasing -DWOMBAT # export BAZ=baz should be ignored. This line isn't right. NO SPACES IN NAMES="valid value" | 2.63384 | 3 |
signin/tests.py | pptnz/swa_team2 | 0 | 1343 | <reponame>pptnz/swa_team2
import json
from django.test import TestCase
from django.contrib.auth.models import User
from .models import CustomUser
from django.apps import apps
from .apps import SigninConfig
class SignInTest(TestCase):
def setUp(self):
self.django_user = User.objects.create_user(username='... | import json
from django.test import TestCase
from django.contrib.auth.models import User
from .models import CustomUser
from django.apps import apps
from .apps import SigninConfig
class SignInTest(TestCase):
def setUp(self):
self.django_user = User.objects.create_user(username='testusername', password='<... | en | 0.186719 | # todo: change this link | 2.507714 | 3 |
tree/list/BinaryNode.py | EliHar/BinaryTree-ADT | 0 | 1344 | <gh_stars>0
__author__ = '<NAME>'
class BinaryNode(object):
def __init__(self, data, left, right):
self.data = data
self.left = left
self.right = right
def getData(self):
return self.data
def getLeft(self):
return self.left
def getRight(self):
return ... | __author__ = '<NAME>'
class BinaryNode(object):
def __init__(self, data, left, right):
self.data = data
self.left = left
self.right = right
def getData(self):
return self.data
def getLeft(self):
return self.left
def getRight(self):
return self.right
... | none | 1 | 3.237373 | 3 | |
boolean2/tokenizer.py | AbrahmAB/booleannet | 0 | 1345 | <reponame>AbrahmAB/booleannet
"""
Main tokenizer.
"""
from itertools import *
import sys, random
import util
import ply.lex as lex
class Lexer:
"""
Lexer for boolean rules
"""
literals = '=*,'
tokens = (
'LABEL', 'ID','STATE', 'ASSIGN', 'EQUAL',
'AND', 'OR', 'NOT',
'NUMBE... | """
Main tokenizer.
"""
from itertools import *
import sys, random
import util
import ply.lex as lex
class Lexer:
"""
Lexer for boolean rules
"""
literals = '=*,'
tokens = (
'LABEL', 'ID','STATE', 'ASSIGN', 'EQUAL',
'AND', 'OR', 'NOT',
'NUMBER', 'LPAREN','RPAREN', 'COMMA'... | en | 0.469962 | Main tokenizer. Lexer for boolean rules # nothing here yet # check for reserved words #.*' Returns elments of the list that are initializers Returns elements where the first token is a LABEL (updating rules with labels) Returns elements where the second token is ASSIGN (updating rules with no LABELs) Returns to... | 3.070866 | 3 |
aiida/cmdline/params/options/test_interactive.py | tomzhang/aiida_core | 1 | 1346 | <reponame>tomzhang/aiida_core
"""Unit tests for the InteractiveOption."""
from __future__ import absolute_import
import unittest
import click
from click.testing import CliRunner
from click.types import IntParamType
from aiida.cmdline.params.options.interactive import InteractiveOption
from aiida.cmdline.params.option... | """Unit tests for the InteractiveOption."""
from __future__ import absolute_import
import unittest
import click
from click.testing import CliRunner
from click.types import IntParamType
from aiida.cmdline.params.options.interactive import InteractiveOption
from aiida.cmdline.params.options import NON_INTERACTIVE
cla... | en | 0.565362 | Unit tests for the InteractiveOption. Param type that only accepts 42 as valid value Unit tests for InteractiveOption. # pylint: disable=too-many-public-methods, missing-docstring Return a simple command with one InteractiveOption, kwargs get relayed to the option. # pylint: disable=no-self-use test command for Interac... | 2.756195 | 3 |
scripts/migration/migrate_registered_meta.py | fabmiz/osf.io | 0 | 1347 | """
Changes existing registered_meta on a node to new schema layout
required for the prereg-prize
"""
import json
import sys
import logging
from modularodm import Q
from framework.mongo import database as db
from framework.mongo.utils import from_mongo
from framework.transactions.context import TokuTransaction
from ... | """
Changes existing registered_meta on a node to new schema layout
required for the prereg-prize
"""
import json
import sys
import logging
from modularodm import Q
from framework.mongo import database as db
from framework.mongo.utils import from_mongo
from framework.transactions.context import TokuTransaction
from ... | en | 0.468509 | Changes existing registered_meta on a node to new schema layout required for the prereg-prize # Unstringify stored metadata # convert registered_schema to list field # append matching schema to node.registered_schema # Skip over missing schemas | 1.911095 | 2 |
pyec/distribution/bayes/structure/basic.py | hypernicon/pyec | 2 | 1348 | """
Copyright (C) 2012 <NAME>
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, publish, distribute, sublice... | """
Copyright (C) 2012 <NAME>
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, publish, distribute, sublice... | en | 0.791528 | Copyright (C) 2012 <NAME> 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, publish, distribute, sublicense,... | 1.899584 | 2 |
graph/tsp.py | pingrunhuang/CodeChallenge | 0 | 1349 | """
given a fully connected undirected graph(If no path exists between two cities, adding an arbitrarily long edge will complete the graph without affecting the optimal tour),
find the path with the lowest cost in total for a salesman to travel from a given start vertex
"""
import time
class Edge:
def __init__(sel... | """
given a fully connected undirected graph(If no path exists between two cities, adding an arbitrarily long edge will complete the graph without affecting the optimal tour),
find the path with the lowest cost in total for a salesman to travel from a given start vertex
"""
import time
class Edge:
def __init__(sel... | en | 0.896779 | given a fully connected undirected graph(If no path exists between two cities, adding an arbitrarily long edge will complete the graph without affecting the optimal tour), find the path with the lowest cost in total for a salesman to travel from a given start vertex This is a fully connected graph with edge weight valu... | 3.875319 | 4 |
projects/code_combat/8_Cloudrip_Mountain/471-Distracting_Dungeon/distracting_dungeon.py | only-romano/junkyard | 0 | 1350 | def moveBothTo(point):
while hero.distanceTo(point) > 1:
hero.move(point)
hero.command(peasant, "move", point)
peasant = hero.findNearest(hero.findFriends())
while True:
hero.command(peasant, "buildXY", "decoy", peasant.pos.x + 2, peasant.pos.y)
var nextPoint = {"x": hero.pos.x,... | def moveBothTo(point):
while hero.distanceTo(point) > 1:
hero.move(point)
hero.command(peasant, "move", point)
peasant = hero.findNearest(hero.findFriends())
while True:
hero.command(peasant, "buildXY", "decoy", peasant.pos.x + 2, peasant.pos.y)
var nextPoint = {"x": hero.pos.x,... | none | 1 | 3.084018 | 3 | |
firstBadVersion.py | pflun/learningAlgorithms | 0 | 1351 | # The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
# def isBadVersion(version):
class Solution(object):
def firstBadVersion(self, n):
start = 1
end = n
while start + 1 < end:
mid = start + (end - start) / 2
if isBadVersi... | # The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
# def isBadVersion(version):
class Solution(object):
def firstBadVersion(self, n):
start = 1
end = n
while start + 1 < end:
mid = start + (end - start) / 2
if isBadVersi... | en | 0.697635 | # The isBadVersion API is already defined for you. # @param version, an integer # @return a bool # def isBadVersion(version): | 3.200849 | 3 |
issues/migrations/0001_initial.py | QizaiMing/ergo-project-manager | 0 | 1352 | # Generated by Django 2.2.12 on 2020-05-01 03:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | # Generated by Django 2.2.12 on 2020-05-01 03:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | en | 0.741862 | # Generated by Django 2.2.12 on 2020-05-01 03:34 | 1.766306 | 2 |
com/binghe/hacker/tools/script/ak/check_virus.py | ffffff0x/python-hacker | 52 | 1353 | <reponame>ffffff0x/python-hacker
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: gbk -*-
# Date: 2019/2/22
# Created by 冰河
# Description 将生成的bindshell.exe提交到vscan.novirusthanks.org检测
# 用法 python check_virus.py -f bindshell.exe
# 博客 https://blog.csdn.net/l1028386804
import re
import httplib
impo... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: gbk -*-
# Date: 2019/2/22
# Created by 冰河
# Description 将生成的bindshell.exe提交到vscan.novirusthanks.org检测
# 用法 python check_virus.py -f bindshell.exe
# 博客 https://blog.csdn.net/l1028386804
import re
import httplib
import time
import os
import optparse... | en | 0.393465 | #!/usr/bin/env python # -*- coding: utf-8 -*- # -*- coding: gbk -*- # Date: 2019/2/22 # Created by 冰河 # Description 将生成的bindshell.exe提交到vscan.novirusthanks.org检测 # 用法 python check_virus.py -f bindshell.exe # 博客 https://blog.csdn.net/l1028386804 | 2.277587 | 2 |
cogs/remind.py | LoganHaug/reminder-bot | 2 | 1354 | import asyncio
from typing import Union
import datetime
import time
from discord.ext import commands
import yaml
from cogs import checks
import database
import utils
# Loads the repeating interval dictionary
with open("conversions.yml", "r") as conversion_file:
conversion_dict = yaml.load(conversion_file, Loade... | import asyncio
from typing import Union
import datetime
import time
from discord.ext import commands
import yaml
from cogs import checks
import database
import utils
# Loads the repeating interval dictionary
with open("conversions.yml", "r") as conversion_file:
conversion_dict = yaml.load(conversion_file, Loade... | en | 0.753433 | # Loads the repeating interval dictionary Updates the schedule Sets up the reminders # Create tasks for all reminders, call the remind function # Run the tasks Execute one reminder # Check if the reminder is in the future and if it exists in the database # Checks if the reminder is still exists, in case of deletion # R... | 2.60372 | 3 |
setup.py | csengor/toraman_py | 2 | 1355 | import setuptools
from toraman.version import __version__
with open('README.md', 'r') as input_file:
long_description = input_file.read()
setuptools.setup(
name='toraman',
version=__version__,
author='<NAME>',
author_email='<EMAIL>',
description='A computer-assisted translation tool package',... | import setuptools
from toraman.version import __version__
with open('README.md', 'r') as input_file:
long_description = input_file.read()
setuptools.setup(
name='toraman',
version=__version__,
author='<NAME>',
author_email='<EMAIL>',
description='A computer-assisted translation tool package',... | none | 1 | 1.572822 | 2 | |
declarations_site/cms_pages/migrations/0015_auto_20150615_0201.py | li-ar/declarations.com.ua | 32 | 1356 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms_pages', '0014_homepage_news_count'),
]
operations = [
migrations.AlterField(
model_name='ne... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms_pages', '0014_homepage_news_count'),
]
operations = [
migrations.AlterField(
model_name='newspage',
... | en | 0.769321 | # -*- coding: utf-8 -*- | 1.255544 | 1 |
tests/models/test_grad_norm.py | nightlessbaron/pytorch-lightning | 3 | 1357 | <gh_stars>1-10
# Copyright The PyTorch Lightning team.
#
# 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... | # Copyright The PyTorch Lightning team.
#
# 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 i... | en | 0.787047 | # Copyright The PyTorch Lightning team. # # 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 i... | 2.06411 | 2 |
tensorflow/tools/compatibility/renames_v2.py | junjun315/tensorflow | 0 | 1358 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | en | 0.760362 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica... | 1.507567 | 2 |
deep_speech_2/decoder.py | Canpio/models | 1 | 1359 | """
CTC-like decoder utilitis.
"""
from itertools import groupby
import numpy as np
def ctc_best_path_decode(probs_seq, vocabulary):
"""
Best path decoding, also called argmax decoding or greedy decoding.
Path consisting of the most probable tokens are further post-processed to
remove consecutive... | """
CTC-like decoder utilitis.
"""
from itertools import groupby
import numpy as np
def ctc_best_path_decode(probs_seq, vocabulary):
"""
Best path decoding, also called argmax decoding or greedy decoding.
Path consisting of the most probable tokens are further post-processed to
remove consecutive... | en | 0.706729 | CTC-like decoder utilitis. Best path decoding, also called argmax decoding or greedy decoding. Path consisting of the most probable tokens are further post-processed to remove consecutive repetitions and all blanks. :param probs_seq: 2-D list of probabilities over the vocabulary for each ... | 2.961212 | 3 |
modules/gitbox/files/asfgit/hooks/sync.py | Humbedooh/infrastructure-puppet | 1 | 1360 | <reponame>Humbedooh/infrastructure-puppet
#!/usr/local/bin/python
import json
import socket
import sys
import asfgit.cfg as cfg
import asfgit.git as git
import asfgit.log as log
import asfgit.util as util
import subprocess, os, time
def main():
ghurl = "git@github:apache/%s.git" % cfg.repo_name
os.chdir("/x1... | #!/usr/local/bin/python
import json
import socket
import sys
import asfgit.cfg as cfg
import asfgit.git as git
import asfgit.log as log
import asfgit.util as util
import subprocess, os, time
def main():
ghurl = "git@github:apache/%s.git" % cfg.repo_name
os.chdir("/x1/repos/asf/%s.git" % cfg.repo_name)
tr... | en | 0.469787 | #!/usr/local/bin/python | 2.096119 | 2 |
rosimport/_rosdef_loader.py | asmodehn/rosimport | 5 | 1361 | <filename>rosimport/_rosdef_loader.py
from __future__ import absolute_import, division, print_function
import contextlib
import importlib
import site
import tempfile
import shutil
from rosimport import genrosmsg_py, genrossrv_py
"""
A module to setup custom importer for .msg and .srv files
Upon import, it will fir... | <filename>rosimport/_rosdef_loader.py
from __future__ import absolute_import, division, print_function
import contextlib
import importlib
import site
import tempfile
import shutil
from rosimport import genrosmsg_py, genrossrv_py
"""
A module to setup custom importer for .msg and .srv files
Upon import, it will fir... | en | 0.779202 | A module to setup custom importer for .msg and .srv files Upon import, it will first find the .msg file, then generate the python module for it, then load it. TODO... # We need to be extra careful with python versions # Ref : https://docs.python.org/dev/library/importlib.html#importlib.import_module # Ref : http://sta... | 2.51159 | 3 |
PyLeague/logger.py | Ahuge/PyLeague | 0 | 1362 | import sys
def color(text, color):
if color == "blue":
color = "0;34m"
elif color == "green":
color = "0;32m"
elif color == "red":
color = "0;31m"
elif color == "yellow":
color = "0;33m"
else:
return text
return "\033[%s%s\033[0m\n" % (color, text)
cla... | import sys
def color(text, color):
if color == "blue":
color = "0;34m"
elif color == "green":
color = "0;32m"
elif color == "red":
color = "0;31m"
elif color == "yellow":
color = "0;33m"
else:
return text
return "\033[%s%s\033[0m\n" % (color, text)
cla... | none | 1 | 3.161652 | 3 | |
setup.py | swtwsk/dbt-airflow-manifest-parser | 0 | 1363 | """dbt_airflow_factory module."""
from setuptools import find_packages, setup
with open("README.md") as f:
README = f.read()
# Runtime Requirements.
INSTALL_REQUIRES = ["pytimeparse==1.1.8"]
# Dev Requirements
EXTRA_REQUIRE = {
"tests": [
"pytest>=6.2.2, <7.0.0",
"pytest-cov>=2.8.0, <3.0.0",... | """dbt_airflow_factory module."""
from setuptools import find_packages, setup
with open("README.md") as f:
README = f.read()
# Runtime Requirements.
INSTALL_REQUIRES = ["pytimeparse==1.1.8"]
# Dev Requirements
EXTRA_REQUIRE = {
"tests": [
"pytest>=6.2.2, <7.0.0",
"pytest-cov>=2.8.0, <3.0.0",... | en | 0.506855 | dbt_airflow_factory module. # Runtime Requirements. # Dev Requirements | 1.806193 | 2 |
nightlightpi/errorstrings.py | jmb/NightLightPi | 2 | 1364 | <reponame>jmb/NightLightPi
# -*- coding: utf-8; -*-
"""Define error strings raised by the application."""
MISSING_CONFIG_VALUE = """
'{0}' is not specified or invalid in the config file!
""".strip()
| # -*- coding: utf-8; -*-
"""Define error strings raised by the application."""
MISSING_CONFIG_VALUE = """
'{0}' is not specified or invalid in the config file!
""".strip() | en | 0.710682 | # -*- coding: utf-8; -*- Define error strings raised by the application. '{0}' is not specified or invalid in the config file! | 1.716629 | 2 |
karabo_bridge/tests/test_serialize.py | European-XFEL/karabo-bridge-py | 6 | 1365 | import numpy as np
import pytest
from karabo_bridge import serialize, deserialize
from .utils import compare_nested_dict
def test_serialize(data, protocol_version):
msg = serialize(data, protocol_version=protocol_version)
assert isinstance(msg, list)
d, m = deserialize(msg)
compare_nested_dict(data... | import numpy as np
import pytest
from karabo_bridge import serialize, deserialize
from .utils import compare_nested_dict
def test_serialize(data, protocol_version):
msg = serialize(data, protocol_version=protocol_version)
assert isinstance(msg, list)
d, m = deserialize(msg)
compare_nested_dict(data... | none | 1 | 2.35271 | 2 | |
indico/testing/fixtures/util.py | bpedersen2/indico | 1 | 1366 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import inspect
from datetime import datetime
import freezegun
import pytest
from sqlalchemy import DateTi... | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import inspect
from datetime import datetime
import freezegun
import pytest
from sqlalchemy import DateTi... | en | 0.783136 | # This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. Monkeypatch all methods from `cls` onto `target`. This utility lets you easily mock multiple methods i... | 2.305679 | 2 |
config.py | RomashkaGang/Update_Checker | 0 | 1367 | <reponame>RomashkaGang/Update_Checker
#!/usr/bin/env python3
# encoding: utf-8
import os
# 是否启用调试 若启用 将不再忽略检查过程中发生的任何异常
# 建议在开发环境中启用 在生产环境中禁用
DEBUG_ENABLE = False
# SQLite 数据库文件名
SQLITE_FILE = "saved.db"
# 日志文件名
LOG_FILE = "log.txt"
# 是否启用日志
ENABLE_LOGGER = True
# 循环检查的间隔时间(默认: 180分钟)
LOOP_CHECK_INTERVAL = 180 * ... | #!/usr/bin/env python3
# encoding: utf-8
import os
# 是否启用调试 若启用 将不再忽略检查过程中发生的任何异常
# 建议在开发环境中启用 在生产环境中禁用
DEBUG_ENABLE = False
# SQLite 数据库文件名
SQLITE_FILE = "saved.db"
# 日志文件名
LOG_FILE = "log.txt"
# 是否启用日志
ENABLE_LOGGER = True
# 循环检查的间隔时间(默认: 180分钟)
LOOP_CHECK_INTERVAL = 180 * 60
# 代理服务器
PROXIES = "127.0.0.1:1080"... | zh | 0.979589 | #!/usr/bin/env python3 # encoding: utf-8 # 是否启用调试 若启用 将不再忽略检查过程中发生的任何异常 # 建议在开发环境中启用 在生产环境中禁用 # SQLite 数据库文件名 # 日志文件名 # 是否启用日志 # 循环检查的间隔时间(默认: 180分钟) # 代理服务器 # 请求超时 # 是否为 Socks5 代理 # 是否启用 TG BOT 发送消息的功能 # TG BOT TOKEN # 发送消息到... | 2.167152 | 2 |
cmdb-compliance/biz/handlers/asset_hipaa_data.py | zjj1002/aws-cloud-cmdb-system | 0 | 1368 | <reponame>zjj1002/aws-cloud-cmdb-system<gh_stars>0
from sqlalchemy import or_
from websdk.db_context import DBContext
from libs.base_handler import BaseHandler
from libs.pagination import pagination_util
from models.hipaa_data import HipaaData, model_to_dict
class HipaaDataHandler(BaseHandler):
@pagination_util
... | from sqlalchemy import or_
from websdk.db_context import DBContext
from libs.base_handler import BaseHandler
from libs.pagination import pagination_util
from models.hipaa_data import HipaaData, model_to_dict
class HipaaDataHandler(BaseHandler):
@pagination_util
def get(self, *args, **kwargs):
key = s... | none | 1 | 2.222179 | 2 | |
scripts/count.py | hellocit/kadai2 | 0 | 1369 | #!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
import time
rospy.init_node('count') # ノード名「count」に設定
pub = rospy.Publisher('count_up', Int32, queue_size=1) # パブリッシャ「count_up」を作成
rate = rospy.Rate(10) # 10Hzで実行
n = 0
time.sleep(2)
w... | #!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
import time
rospy.init_node('count') # ノード名「count」に設定
pub = rospy.Publisher('count_up', Int32, queue_size=1) # パブリッシャ「count_up」を作成
rate = rospy.Rate(10) # 10Hzで実行
n = 0
time.sleep(2)
w... | ja | 0.969593 | #!/usr/bin/env python3 # ノード名「count」に設定 # パブリッシャ「count_up」を作成 # 10Hzで実行 | 2.67838 | 3 |
snmp/nav/smidumps/ZyXEL_GS4012F_mib.py | alexanderfefelov/nav-add-ons | 0 | 1370 | # python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python ZYXEL-GS4012F-MIB
FILENAME = "mibs/ZyXEL/zyxel-GS4012F.mib"
MIB = {
"moduleName" : "ZYXEL-GS4012F-MIB",
"ZYXEL-GS4012F-MIB" : {
"nodetype" : "module",
"language" : "SMIv2",
"organizat... | # python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python ZYXEL-GS4012F-MIB
FILENAME = "mibs/ZyXEL/zyxel-GS4012F.mib"
MIB = {
"moduleName" : "ZYXEL-GS4012F-MIB",
"ZYXEL-GS4012F-MIB" : {
"nodetype" : "module",
"language" : "SMIv2",
"organizat... | en | 0.758066 | # python version 1.0 DO NOT EDIT # # Generated by smidump version 0.4.8: # # smidump -f python ZYXEL-GS4012F-MIB ZyXEL Fault event trap definitions [Revision added by libsmi due to a LAST-UPDATED clause.] [Revision added by libsmi due to a LAST-UPDATED clause.] Universal Time Coordinated as a 32-bit value that d... | 1.418363 | 1 |
rx/concurrency/timeoutscheduler.py | yutiansut/RxPY | 1 | 1371 | <filename>rx/concurrency/timeoutscheduler.py
import logging
from threading import Timer
from datetime import timedelta
from rx.core import Scheduler, Disposable
from rx.disposables import SingleAssignmentDisposable, CompositeDisposable
from .schedulerbase import SchedulerBase
log = logging.getLogger("Rx")
class Ti... | <filename>rx/concurrency/timeoutscheduler.py
import logging
from threading import Timer
from datetime import timedelta
from rx.core import Scheduler, Disposable
from rx.disposables import SingleAssignmentDisposable, CompositeDisposable
from .schedulerbase import SchedulerBase
log = logging.getLogger("Rx")
class Ti... | en | 0.919025 | A scheduler that schedules work via a timed callback based upon platform. Schedules an action to be executed. Schedules an action to be executed after duetime. Schedules an action to be executed after duetime. | 2.800886 | 3 |
vgazer/version/custom_checker/inputproto.py | edomin/vgazer | 2 | 1372 | import requests
from bs4 import BeautifulSoup
def Check(auth, mirrors):
response = requests.get("https://www.x.org/releases/individual/proto/")
html = response.content.decode("utf-8")
parsedHtml = BeautifulSoup(html, "html.parser")
links = parsedHtml.find_all("a")
maxVersionMajor = -1
maxVers... | import requests
from bs4 import BeautifulSoup
def Check(auth, mirrors):
response = requests.get("https://www.x.org/releases/individual/proto/")
html = response.content.decode("utf-8")
parsedHtml = BeautifulSoup(html, "html.parser")
links = parsedHtml.find_all("a")
maxVersionMajor = -1
maxVers... | none | 1 | 2.861677 | 3 | |
src/pandas_profiling/model/summary_helpers.py | briangrahamww/pandas-profiling | 0 | 1373 | import os
import string
from collections import Counter
from datetime import datetime
from functools import partial
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from scipy.stats.stats import chisquare
from tangled_up_in_unicode import block, block_abbr, categor... | import os
import string
from collections import Counter
from datetime import datetime
from functools import partial
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from scipy.stats.stats import chisquare
from tangled_up_in_unicode import block, block_abbr, categor... | en | 0.705743 | Median Absolute Deviation: a "Robust" version of standard deviation.
Indices variability of the sample.
https://en.wikipedia.org/wiki/Median_absolute_deviation Args:
series: series to summarize
Returns: # Transform # Transform some more Args:
series: series to summarize
Returns... | 2.256876 | 2 |
inverse_warp.py | ZephyrII/competitive_colaboration | 357 | 1374 | # Author: <NAME>
# Copyright (c) 2019, <NAME>
# All rights reserved.
# based on github.com/ClementPinard/SfMLearner-Pytorch
from __future__ import division
import torch
from torch.autograd import Variable
pixel_coords = None
def set_id_grid(depth):
global pixel_coords
b, h, w = depth.size()
i_range = Va... | # Author: <NAME>
# Copyright (c) 2019, <NAME>
# All rights reserved.
# based on github.com/ClementPinard/SfMLearner-Pytorch
from __future__ import division
import torch
from torch.autograd import Variable
pixel_coords = None
def set_id_grid(depth):
global pixel_coords
b, h, w = depth.size()
i_range = Va... | en | 0.68275 | # Author: <NAME> # Copyright (c) 2019, <NAME> # All rights reserved. # based on github.com/ClementPinard/SfMLearner-Pytorch # [1, H, W] # [1, H, W] # [1, 3, H, W] Transform coordinates in the pixel frame to the camera frame. Args: depth: depth maps -- [B, H, W] intrinsics_inv: intrinsics_inv matrix ... | 2.317919 | 2 |
lingvo/core/egdd.py | ramonsanabria/lingvo | 0 | 1375 | <reponame>ramonsanabria/lingvo<gh_stars>0
# Lint as: python2, python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... | # Lint as: python2, python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | en | 0.726174 | # Lint as: python2, python3 # Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ... | 1.888086 | 2 |
examples/nn_cudamat.py | cloudspectatordevelopment/cudamat | 526 | 1376 | <filename>examples/nn_cudamat.py
# This file shows how to implement a single hidden layer neural network for
# performing binary classification on the GPU using cudamat.
from __future__ import division
import pdb
import time
import numpy as np
import cudamat as cm
from cudamat import learn as cl
import util
# initial... | <filename>examples/nn_cudamat.py
# This file shows how to implement a single hidden layer neural network for
# performing binary classification on the GPU using cudamat.
from __future__ import division
import pdb
import time
import numpy as np
import cudamat as cm
from cudamat import learn as cl
import util
# initial... | en | 0.618641 | # This file shows how to implement a single hidden layer neural network for # performing binary classification on the GPU using cudamat. # initialize CUDA # load data # Put training data onto the GPU. # training parameters # model parameters # initialize weights # initialize weight update matrices # initialize temporar... | 3.097571 | 3 |
fair/forcing/ozone_tr.py | znicholls/FAIR | 1 | 1377 | <reponame>znicholls/FAIR<filename>fair/forcing/ozone_tr.py
from __future__ import division
import numpy as np
from ..constants import molwt
def regress(emissions,
beta=np.array([2.8249e-4, 1.0695e-4, -9.3604e-4, 99.7831e-4])):
"""Calculates tropospheric ozone forcing from precursor emissions.
In... | from __future__ import division
import numpy as np
from ..constants import molwt
def regress(emissions,
beta=np.array([2.8249e-4, 1.0695e-4, -9.3604e-4, 99.7831e-4])):
"""Calculates tropospheric ozone forcing from precursor emissions.
Inputs: (nt x 40) emissions array
Keywords:
beta... | en | 0.747201 | Calculates tropospheric ozone forcing from precursor emissions. Inputs: (nt x 40) emissions array Keywords: beta: 4-element array of regression coefficients of precursor radiative efficiency, W m-2 (Mt yr-1)-1. order is [CH4, CO, NMVOC, NOx] Outputs: tropospher... | 2.542857 | 3 |
tests/test_publish.py | oarepo/oarepo-references-draft | 0 | 1378 | import uuid
from invenio_indexer.api import RecordIndexer
from invenio_pidstore.models import PersistentIdentifier, PIDStatus
from invenio_records_draft.api import RecordContext
from invenio_records_draft.proxies import current_drafts
from invenio_search import RecordsSearch, current_search, current_search_client
from... | import uuid
from invenio_indexer.api import RecordIndexer
from invenio_pidstore.models import PersistentIdentifier, PIDStatus
from invenio_records_draft.api import RecordContext
from invenio_records_draft.proxies import current_drafts
from invenio_search import RecordsSearch, current_search, current_search_client
from... | none | 1 | 1.921927 | 2 | |
examples/ROS/tiscamera.py | xiaotiansf/tiscamera | 0 | 1379 | import os
import subprocess
from collections import namedtuple
import gi
gi.require_version("Gst", "1.0")
gi.require_version("Tcam", "0.1")
from gi.repository import Tcam, Gst, GLib, GObject
DeviceInfo = namedtuple("DeviceInfo", "status name identifier connection_type")
CameraProperty = namedtuple("CameraProperty", ... | import os
import subprocess
from collections import namedtuple
import gi
gi.require_version("Gst", "1.0")
gi.require_version("Tcam", "0.1")
from gi.repository import Tcam, Gst, GLib, GObject
DeviceInfo = namedtuple("DeviceInfo", "status name identifier connection_type")
CameraProperty = namedtuple("CameraProperty", ... | en | 0.684142 | # Disable pylint false positives # pylint:disable=E0712 Constructor. Creates the sink pipeline and the source pipeline. :param serial: Serial number of the camera to use. :param width: Width of the video format, e.g. 640, 1920 etc, :param height: Height of the video format, e.g. 480, 10... | 2.261326 | 2 |
helpers/config.py | bertrand-caron/cv_blog_flask | 0 | 1380 | from typing import Dict, Any
from yaml import load
def get_config() -> Dict[str, Any]:
try:
return load(open('config/config.yml').read())
except Exception as e:
raise Exception('ERROR: Missing config/config.yml file.') from e
CONFIG = get_config()
| from typing import Dict, Any
from yaml import load
def get_config() -> Dict[str, Any]:
try:
return load(open('config/config.yml').read())
except Exception as e:
raise Exception('ERROR: Missing config/config.yml file.') from e
CONFIG = get_config()
| none | 1 | 2.827915 | 3 | |
raman/unmixing.py | falckt/raman | 1 | 1381 | <filename>raman/unmixing.py<gh_stars>1-10
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
#
# SPDX-License-Identifier: BSD-3-Clause
import collections
from itertools import product
import cvxpy as cp
import numpy as np
def sunsal_tv(A, Y, lambda_1, lambda_tv, sweep='prod', tv_type='iso', additional_constraint='... | <filename>raman/unmixing.py<gh_stars>1-10
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
#
# SPDX-License-Identifier: BSD-3-Clause
import collections
from itertools import product
import cvxpy as cp
import numpy as np
def sunsal_tv(A, Y, lambda_1, lambda_tv, sweep='prod', tv_type='iso', additional_constraint='... | en | 0.656268 | # Author: <NAME> <<EMAIL>> # # License: BSD 3 clause # # SPDX-License-Identifier: BSD-3-Clause Sparse unmixing via variable splitting and augmented Lagrangian and total variation (SUnSAL-TV) solves the following optimization problem min || Y - A * X ||_F + lambda_1 || X ||_1 + lambda_TV || X ||_TV X... | 2.220629 | 2 |
test_stock.py | ucsb-cs48-w19/6pm-stock-trading | 1 | 1382 | import pytest
def test_stock():
assert(0 == 0)
| import pytest
def test_stock():
assert(0 == 0)
| none | 1 | 1.537385 | 2 | |
TM1py/Objects/ElementAttribute.py | damirishpreet/TM1py | 19 | 1383 | <gh_stars>10-100
# -*- coding: utf-8 -*-
import json
from TM1py.Objects.TM1Object import TM1Object
class ElementAttribute(TM1Object):
""" Abstraction of TM1 Element Attributes
"""
valid_types = ['NUMERIC', 'STRING', 'ALIAS']
def __init__(self, name, attribute_type):
self.name = name
... | # -*- coding: utf-8 -*-
import json
from TM1py.Objects.TM1Object import TM1Object
class ElementAttribute(TM1Object):
""" Abstraction of TM1 Element Attributes
"""
valid_types = ['NUMERIC', 'STRING', 'ALIAS']
def __init__(self, name, attribute_type):
self.name = name
self.attrib... | en | 0.574176 | # -*- coding: utf-8 -*- Abstraction of TM1 Element Attributes | 2.586565 | 3 |
account.py | MaherClinc/stockly-bs | 0 | 1384 | from sqlalchemy import exc
from sqlalchemy.sql.expression import func
from models import Watchlist, Portfolio, Activity
from app import db
import metric
def buy_stock(ticker, units):
unit_price = metric.get_price(ticker)
total_price = units * unit_price
max_id = db.session.query(func.max(Activity.activity... | from sqlalchemy import exc
from sqlalchemy.sql.expression import func
from models import Watchlist, Portfolio, Activity
from app import db
import metric
def buy_stock(ticker, units):
unit_price = metric.get_price(ticker)
total_price = units * unit_price
max_id = db.session.query(func.max(Activity.activity... | none | 1 | 2.555761 | 3 | |
scripts/addons/kekit/ke_fit2grid.py | Tilapiatsu/blender-custom_conf | 2 | 1385 | <filename>scripts/addons/kekit/ke_fit2grid.py
bl_info = {
"name": "ke_fit2grid",
"author": "<NAME>",
"category": "Modeling",
"version": (1, 0, 2),
"blender": (2, 80, 0),
}
import bpy
import bmesh
from .ke_utils import get_loops, correct_normal, average_vector
from mathutils import Vector, Matrix
d... | <filename>scripts/addons/kekit/ke_fit2grid.py
bl_info = {
"name": "ke_fit2grid",
"author": "<NAME>",
"category": "Modeling",
"version": (1, 0, 2),
"blender": (2, 80, 0),
}
import bpy
import bmesh
from .ke_utils import get_loops, correct_normal, average_vector
from mathutils import Vector, Matrix
d... | en | 0.178115 | # ------------------------------------------------------------------------------------------------- # Class Registration & Unregistration # ------------------------------------------------------------------------------------------------- | 1.93745 | 2 |
tests/test_update.py | en0/pyavl3 | 0 | 1386 | import unittest
from pyavl3 import AVLTree
class AVLTreeUpdateTest(unittest.TestCase):
def test_add_one(self):
a = AVLTree()
a.update({1:'a'})
self.assertEqual(len(a), 1)
| import unittest
from pyavl3 import AVLTree
class AVLTreeUpdateTest(unittest.TestCase):
def test_add_one(self):
a = AVLTree()
a.update({1:'a'})
self.assertEqual(len(a), 1)
| none | 1 | 2.854004 | 3 | |
python/day5-1.py | Aerdan/adventcode-2020 | 0 | 1387 | #!/usr/bin/env python3
def binary(code, max, bits):
ret = []
for i in range(max):
ret.append(bits[code[i]])
return int(''.join(ret), base=2)
mid = 0
with open('input5.txt') as f:
for line in f.readlines():
line = line[:-1]
row = binary(line[:7], 7, {'F': '0', 'B': '1'})
... | #!/usr/bin/env python3
def binary(code, max, bits):
ret = []
for i in range(max):
ret.append(bits[code[i]])
return int(''.join(ret), base=2)
mid = 0
with open('input5.txt') as f:
for line in f.readlines():
line = line[:-1]
row = binary(line[:7], 7, {'F': '0', 'B': '1'})
... | fr | 0.221828 | #!/usr/bin/env python3 | 3.449357 | 3 |
custom_stocks_py/base.py | baramsalem/Custom-stocks-py | 0 | 1388 | """
custom_stocks_py base module.
This is the principal module of the custom_stocks_py project.
here you put your main classes and objects.
Be creative! do whatever you want!
If you want to replace this with a Flask application run:
$ make init
and then choose `flask` as template.
"""
class BaseClass:
de... | """
custom_stocks_py base module.
This is the principal module of the custom_stocks_py project.
here you put your main classes and objects.
Be creative! do whatever you want!
If you want to replace this with a Flask application run:
$ make init
and then choose `flask` as template.
"""
class BaseClass:
de... | en | 0.797984 | custom_stocks_py base module. This is the principal module of the custom_stocks_py project. here you put your main classes and objects. Be creative! do whatever you want! If you want to replace this with a Flask application run: $ make init and then choose `flask` as template. Base method. Base function. | 2.621208 | 3 |
dummy_server.py | dpmkl/heimdall | 0 | 1389 | #!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
self.wfile.write("Hel... | #!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
self.wfile.write("Hel... | ru | 0.26433 | #!/usr/bin/env python | 2.978213 | 3 |
cimsparql/__init__.py | nalu-svk/cimsparql | 0 | 1390 | <gh_stars>0
"""Library for CIM sparql queries"""
__version__ = "1.9.0"
| """Library for CIM sparql queries"""
__version__ = "1.9.0" | en | 0.79864 | Library for CIM sparql queries | 0.877151 | 1 |
scripts/49-cat-logs.py | jmviz/xd | 179 | 1391 | #!/usr/bin/env python3
# Usage:
# $0 -o log.txt products/
#
# concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log
from xdfile.utils import find_files_with_time, open_output, get_args
import boto3
# from boto.s3.connection import S3Connection
import os
def main():
a... | #!/usr/bin/env python3
# Usage:
# $0 -o log.txt products/
#
# concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log
from xdfile.utils import find_files_with_time, open_output, get_args
import boto3
# from boto.s3.connection import S3Connection
import os
def main():
a... | en | 0.60079 | #!/usr/bin/env python3 # Usage: # $0 -o log.txt products/ # # concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log # from boto.s3.connection import S3Connection # bucket = conn.get_bucket(s3path) # last_modified # earliest first | 2.453612 | 2 |
manuscript/link_checker.py | wuyang1002431655/tango_with_django_19 | 244 | 1392 | # Checks for broken links in the book chapters, printing the status of each link found to stdout.
# The Python package 'requests' must be installed and available for this simple module to work.
# Author: <NAME>
# Date: 2017-02-14
import re
import requests
def main(chapters_list_filename, hide_success=True):
"""
hide... | # Checks for broken links in the book chapters, printing the status of each link found to stdout.
# The Python package 'requests' must be installed and available for this simple module to work.
# Author: <NAME>
# Date: 2017-02-14
import re
import requests
def main(chapters_list_filename, hide_success=True):
"""
hide... | en | 0.727999 | # Checks for broken links in the book chapters, printing the status of each link found to stdout. # The Python package 'requests' must be installed and available for this simple module to work. # Author: <NAME> # Date: 2017-02-14 hide_success = a boolean switch that determines whether to show URLs that return a HTTP 20... | 3.612088 | 4 |
service/__init__.py | 2890841438/fast-index.py | 4 | 1393 | <filename>service/__init__.py
# -*- coding = utf-8 -*-
# @Time: 2020/9/4 18:52
# @Author: dimples_yj
# @File: __init__.py.py
# @Software: PyCharm
| <filename>service/__init__.py
# -*- coding = utf-8 -*-
# @Time: 2020/9/4 18:52
# @Author: dimples_yj
# @File: __init__.py.py
# @Software: PyCharm
| en | 0.426971 | # -*- coding = utf-8 -*- # @Time: 2020/9/4 18:52 # @Author: dimples_yj # @File: __init__.py.py # @Software: PyCharm | 1.004822 | 1 |
CLIP-ViL-Direct/vqa/pythia_clip_grid_feature.py | HermannLiang/CLIP-ViL | 0 | 1394 | <reponame>HermannLiang/CLIP-ViL
#!/usr/bin/env python3
"""
Grid features extraction script.
"""
import argparse
import os
import torch
import tqdm
from fvcore.common.file_io import PathManager
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.engine import d... | #!/usr/bin/env python3
"""
Grid features extraction script.
"""
import argparse
import os
import torch
import tqdm
from fvcore.common.file_io import PathManager
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.engine import default_setup
from detectron2.eva... | en | 0.609244 | #!/usr/bin/env python3 Grid features extraction script. # from timm.models.vision_transformer import resize_pos_embed # A simple mapper from object detection dataset to VQA dataset names #dataset_to_folder_mapper['coco_2014_val'] = 'trainval2014' #dataset_to_folder_mapper['coco_2014_train'] = 'trainval2014' # One may n... | 2.081019 | 2 |
src/node.py | aerendon/blockchain-basics | 6 | 1395 | <filename>src/node.py
from flask import Flask, request
import time
import requests
import json
from blockchain import Blockchain
from block import Block
app = Flask(__name__)
blockchain = Blockchain()
peers = set()
@app.route('/add_nodes', methods=['POST'])
def register_new_peers():
nodes = request.get_json()
... | <filename>src/node.py
from flask import Flask, request
import time
import requests
import json
from blockchain import Blockchain
from block import Block
app = Flask(__name__)
blockchain = Blockchain()
peers = set()
@app.route('/add_nodes', methods=['POST'])
def register_new_peers():
nodes = request.get_json()
... | en | 0.41177 | #{} is mined.".format(result) | 2.995811 | 3 |
Luke 02/02.py | Nilzone-/Knowit-Julekalender-2017 | 0 | 1396 | import numpy as np
size = 1000
def create_wall(x, y):
return "{0:b}".format(x**3 + 12*x*y + 5*x*y**2).count("1") & 1
def build_grid():
return np.array([create_wall(j+1, i+1) for i in range(size) for j in range(size)]).reshape(size, size)
def visit(grid, x=0, y=0):
if grid[x][y]:
return
grid[x][y] = 1
... | import numpy as np
size = 1000
def create_wall(x, y):
return "{0:b}".format(x**3 + 12*x*y + 5*x*y**2).count("1") & 1
def build_grid():
return np.array([create_wall(j+1, i+1) for i in range(size) for j in range(size)]).reshape(size, size)
def visit(grid, x=0, y=0):
if grid[x][y]:
return
grid[x][y] = 1
... | none | 1 | 3.496632 | 3 | |
databases/music.py | danielicapui/programa-o-avancada | 0 | 1397 | from utills import *
conn,cur=start('music')
criarTabela("tracks","title text,plays integer")
music=[('trunder',20),
('my way',15)]
insertInto("tracks","title,plays",music)
#cur.executemany("insert into tracks (title,plays) values (?,?)",music)
buscaTabela("tracks","title")
conn.commit()
conn.close()
| from utills import *
conn,cur=start('music')
criarTabela("tracks","title text,plays integer")
music=[('trunder',20),
('my way',15)]
insertInto("tracks","title,plays",music)
#cur.executemany("insert into tracks (title,plays) values (?,?)",music)
buscaTabela("tracks","title")
conn.commit()
conn.close()
| en | 0.761056 | #cur.executemany("insert into tracks (title,plays) values (?,?)",music) | 2.789932 | 3 |
video_analysis/code/scene_postprocess.py | pdxcycling/carv.io | 0 | 1398 | <filename>video_analysis/code/scene_postprocess.py<gh_stars>0
import pandas as pd
import numpy as np
import re
from collections import Counter
from flow_preprocess import FlowPreprocess
class ScenePostprocess(object):
"""
Heavy-lifting macro-feature class
"""
def __init__(self, flow_df, quality_df, re... | <filename>video_analysis/code/scene_postprocess.py<gh_stars>0
import pandas as pd
import numpy as np
import re
from collections import Counter
from flow_preprocess import FlowPreprocess
class ScenePostprocess(object):
"""
Heavy-lifting macro-feature class
"""
def __init__(self, flow_df, quality_df, re... | en | 0.837314 | Heavy-lifting macro-feature class Default constructor Args: flow_df: Optical flow dataframe quality_df: Image quality dataframe remove_transitions: whether to remove frames around scene transitions Returns: Nothing ## Do som... | 2.769227 | 3 |
examples/pytorch/mnist/plot.py | ThomasRot/rational_activations | 0 | 1399 | import torch
import numpy as np
import pickle
torch.manual_seed(17)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
np.random.seed(17)
import argparse
import torch.nn as nn
import torch.nn.functional as F
import matplotlib
import os
from rational.torch import Rational, RecurrentRationa... | import torch
import numpy as np
import pickle
torch.manual_seed(17)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
np.random.seed(17)
import argparse
import torch.nn as nn
import torch.nn.functional as F
import matplotlib
import os
from rational.torch import Rational, RecurrentRationa... | en | 0.472471 | # sum up batch loss # get the index of the max log-probability # Training settings # activation_function_keys = [x for x in list(actfvs.keys()) if 'pau' in x] # activation_function_keys = ['pau'] # activation_function_keys = ['recurrent_pau'] # Simple CNN with 3 Conv # lr_scheduler_milestones = [40, 80] # VGG # dict(m... | 2.341586 | 2 |