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 |
|---|---|---|---|---|---|---|---|---|---|---|
pymutual/__init__.py | kimballh/pymutual | 0 | 2200 | from .session import Session, MutualAPI | from .session import Session, MutualAPI | none | 1 | 1.104254 | 1 | |
forms.py | Joshua-Barawa/pitches-IP | 0 | 2201 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import InputRequired, Email, ValidationError
from models import User
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address', validators=[InputRequired(), Email()])
username ... | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import InputRequired, Email, ValidationError
from models import User
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address', validators=[InputRequired(), Email()])
username ... | none | 1 | 3.295693 | 3 | |
plugins/barracuda_waf/komand_barracuda_waf/actions/create_security_policy/schema.py | lukaszlaszuk/insightconnect-plugins | 46 | 2202 | # GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Creates a security policy with the default values"
class Input:
NAME = "name"
class Output:
ID = "id"
class CreateSecurityPolicyInput(komand.Input):
schema = json.loads("""
{
"type": "o... | # GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Creates a security policy with the default values"
class Input:
NAME = "name"
class Output:
ID = "id"
class CreateSecurityPolicyInput(komand.Input):
schema = json.loads("""
{
"type": "o... | en | 0.364717 | # GENERATED BY KOMAND SDK - DO NOT EDIT { "type": "object", "title": "Variables", "properties": { "name": { "type": "string", "title": "Name", "description": "The name of the security policy that needs to be created", "order": 1 } }, "required": [ "name" ] } { "type": "... | 2.552905 | 3 |
examples/dhc/rule_example.py | fruttasecca/hay_checker | 2 | 2203 | <reponame>fruttasecca/hay_checker<filename>examples/dhc/rule_example.py<gh_stars>1-10
#!/usr/bin/python3
from pyspark.sql import SparkSession
from haychecker.dhc.metrics import rule
spark = SparkSession.builder.appName("rule_example").getOrCreate()
df = spark.read.format("csv").option("header", "true").load("example... | #!/usr/bin/python3
from pyspark.sql import SparkSession
from haychecker.dhc.metrics import rule
spark = SparkSession.builder.appName("rule_example").getOrCreate()
df = spark.read.format("csv").option("header", "true").load("examples/resources/employees.csv")
df.show()
condition1 = {"column": "salary", "operator": ... | fr | 0.386793 | #!/usr/bin/python3 | 2.959672 | 3 |
secure_message/common/utilities.py | uk-gov-mirror/ONSdigital.ras-secure-message | 0 | 2204 | import collections
import logging
import urllib.parse
from structlog import wrap_logger
from secure_message.constants import MESSAGE_BY_ID_ENDPOINT, MESSAGE_LIST_ENDPOINT, MESSAGE_QUERY_LIMIT
from secure_message.services.service_toggles import party, internal_user_service
logger = wrap_logger(logging.getLogger(__nam... | import collections
import logging
import urllib.parse
from structlog import wrap_logger
from secure_message.constants import MESSAGE_BY_ID_ENDPOINT, MESSAGE_LIST_ENDPOINT, MESSAGE_QUERY_LIMIT
from secure_message.services.service_toggles import party, internal_user_service
logger = wrap_logger(logging.getLogger(__nam... | en | 0.852816 | # NOQA pylint:disable=too-complex extract options from request , allow label to be set by caller :param args: contains search arguments. Not all end points support all args :returns: MessageArgs named tuple containing the args for the search business_id If set , restricts search to conversations regarding... | 2.438225 | 2 |
notegame/games/nonogram/core/renderer.py | notechats/notegame | 0 | 2205 | <reponame>notechats/notegame
# -*- coding: utf-8 -*-
"""
Defines various renderers for the game of nonogram
"""
from abc import ABC
from sys import stdout
from notetool.tool.log import logger
from six import integer_types, itervalues, text_type
from ..utils.iter import max_safe, pad
from ..utils.other import two_pow... | # -*- coding: utf-8 -*-
"""
Defines various renderers for the game of nonogram
"""
from abc import ABC
from sys import stdout
from notetool.tool.log import logger
from six import integer_types, itervalues, text_type
from ..utils.iter import max_safe, pad
from ..utils.other import two_powers
from .common import BOX, ... | en | 0.841031 | # -*- coding: utf-8 -*- Defines various renderers for the game of nonogram Represent basic rendered cell How the cell can be printed as a text Represent upper-left cell (where the thumbnail of the puzzle usually drawn). Represent cell that is part of description (clue). They are usually drawn on the top and on ... | 3.235308 | 3 |
sympy/printing/lambdarepr.py | Carreau/sympy | 4 | 2206 | <filename>sympy/printing/lambdarepr.py
from __future__ import print_function, division
from .str import StrPrinter
from sympy.utilities import default_sort_key
class LambdaPrinter(StrPrinter):
"""
This printer converts expressions into strings that can be used by
lambdify.
"""
def _print_MatrixB... | <filename>sympy/printing/lambdarepr.py
from __future__ import print_function, division
from .str import StrPrinter
from sympy.utilities import default_sort_key
class LambdaPrinter(StrPrinter):
"""
This printer converts expressions into strings that can be used by
lambdify.
"""
def _print_MatrixB... | en | 0.820896 | This printer converts expressions into strings that can be used by lambdify. Numpy printer which handles vectorized piecewise functions, logical operators, etc. # Print tuples here instead of lists because numba supports # tuples in nopython mode. # DotProduct allows any shape order, but numpy.dot does matr... | 2.841442 | 3 |
python/fill_na_v2.py | fredmell/CS229Project | 0 | 2207 | <filename>python/fill_na_v2.py
"""
Fill na with most common of the whole column
"""
import numpy as np
import pandas as pd
import time
import matplotlib.pyplot as plt
from datetime import datetime
import re
from collections import Counter
from statistics import median
from tqdm import tqdm
def find_most_common_value... | <filename>python/fill_na_v2.py
"""
Fill na with most common of the whole column
"""
import numpy as np
import pandas as pd
import time
import matplotlib.pyplot as plt
from datetime import datetime
import re
from collections import Counter
from statistics import median
from tqdm import tqdm
def find_most_common_value... | en | 0.888486 | Fill na with most common of the whole column | 3.090991 | 3 |
GUI Applications/calc.py | jaiswalIT02/pythonprograms | 0 | 2208 | <filename>GUI Applications/calc.py
from tkinter import Tk
from tkinter import Entry
from tkinter import Button
from tkinter import StringVar
t=Tk()
t.title("<NAME>")
t.geometry("425x300")
t.resizable(0,0)
t.configure(background="black")#back ground color
a=StringVar()
def show(c):
a.set(a.get()+c)
def equal():... | <filename>GUI Applications/calc.py
from tkinter import Tk
from tkinter import Entry
from tkinter import Button
from tkinter import StringVar
t=Tk()
t.title("<NAME>")
t.geometry("425x300")
t.resizable(0,0)
t.configure(background="black")#back ground color
a=StringVar()
def show(c):
a.set(a.get()+c)
def equal():... | en | 0.81399 | #back ground color | 3.465944 | 3 |
core/models.py | uktrade/great-cms | 10 | 2209 | import hashlib
import mimetypes
from urllib.parse import unquote
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.http import HttpResponseRedirect
from django.template.loader import render_to_string
from django.urls import reverse
from django.... | import hashlib
import mimetypes
from urllib.parse import unquote
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.http import HttpResponseRedirect
from django.template.loader import render_to_string
from django.urls import reverse
from django.... | en | 0.806349 | # If we make a Redirect appear as a Snippet, we can sync it via Wagtail-Transfer # left null because was an existing field # TO COME: support for more than just English # Automatically set slug on save, if not already set Modified version of django_extensions.db.models.TimeStampedModel Unfortunately, because null=... | 1.356844 | 1 |
CV/Effective Transformer-based Solution for RSNA Intracranial Hemorrhage Detection/easymia/transforms/transforms.py | dumpmemory/Research | 0 | 2210 | # -*-coding utf-8 -*-
##########################################################################
#
# Copyright (c) 2022 Baidu.com, Inc. 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 th... | # -*-coding utf-8 -*-
##########################################################################
#
# Copyright (c) 2022 Baidu.com, Inc. 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 th... | en | 0.70835 | # -*-coding utf-8 -*- ########################################################################## # # Copyright (c) 2022 Baidu.com, Inc. 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 th... | 2.128579 | 2 |
tests/ui/terms/test_views.py | galterlibrary/InvenioRDM-at-NU | 6 | 2211 | # -*- coding: utf-8 -*-
#
# This file is part of menRva.
# Copyright (C) 2018-present NU,FSM,GHSL.
#
# menRva is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test terms views.py"""
from cd2h_repo_project.modules.terms.views import ... | # -*- coding: utf-8 -*-
#
# This file is part of menRva.
# Copyright (C) 2018-present NU,FSM,GHSL.
#
# menRva is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test terms views.py"""
from cd2h_repo_project.modules.terms.views import ... | en | 0.799061 | # -*- coding: utf-8 -*- # # This file is part of menRva. # Copyright (C) 2018-present NU,FSM,GHSL. # # menRva is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. Test terms views.py | 2.200115 | 2 |
main.py | alamin3637k/Searcher | 1 | 2212 | <gh_stars>1-10
import webbrowser
import wikipedia
import requests
def yt_search(search: str):
webbrowser.open_new_tab(f"https://www.youtube.com/results?search_query={search}")
def google_search(search: str):
webbrowser.open_new_tab(f"https://www.google.com/search?q={search}")
def bing_search(search: str):
... | import webbrowser
import wikipedia
import requests
def yt_search(search: str):
webbrowser.open_new_tab(f"https://www.youtube.com/results?search_query={search}")
def google_search(search: str):
webbrowser.open_new_tab(f"https://www.google.com/search?q={search}")
def bing_search(search: str):
webbrowser.op... | en | 0.574001 | #search/{search}") please enter site name with http information | 3.303164 | 3 |
hw1.py | ptsurko/coursera_crypt | 0 | 2213 | <reponame>ptsurko/coursera_crypt<filename>hw1.py
import string
from timeit import itertools
s1 = '<KEY>'
s2 = '<KEY>'
s3 = '32510ba9a7b2bba9b8005d43a304b5714cc0bb0c8a34884dd91304b8ad40b62b07df44ba6e9d8a2368e51d04e0e7b207b70b9b8261112bacb6c866a232dfe257527dc29398f5f3251a0d47e503c66e935de81230b59b7afb5f41afa8d661cb'
s4 ... | import string
from timeit import itertools
s1 = '<KEY>'
s2 = '<KEY>'
s3 = '32510ba9a7b2bba9b8005d43a304b5714cc0bb0c8a34884dd91304b8ad40b62b07df44ba6e9d8a2368e51d04e0e7b207b70b9b8261112bacb6c866a232dfe257527dc29398f5f3251a0d47e503c66e935de81230b59b7afb5f41afa8d661cb'
s4 = '32510ba9aab2a8a4fd06414fb517b5605cc0aa0dc91a89... | en | 0.282339 | # xor two strings of different lengths # a = a.decode('hex') # b = b.decode('hex') #.encode('hex') #.encode('hex') #.encode('hex') # def main(): # for c in combinations('ABCD', 2): # print c # WTF??? # max_len = max(combinations, key=lambda x: len(x)) # print max_len #%d;' % ord(ch) #???... | 3.006559 | 3 |
moe/bandit/ucb/ucb_interface.py | dstoeckel/MOE | 966 | 2214 | # -*- coding: utf-8 -*-
"""Classes (Python) to compute the Bandit UCB (Upper Confidence Bound) arm allocation and choosing the arm to pull next.
See :mod:`moe.bandit.bandit_interface` for further details on bandit.
"""
import copy
from abc import abstractmethod
from moe.bandit.bandit_interface import BanditInterfac... | # -*- coding: utf-8 -*-
"""Classes (Python) to compute the Bandit UCB (Upper Confidence Bound) arm allocation and choosing the arm to pull next.
See :mod:`moe.bandit.bandit_interface` for further details on bandit.
"""
import copy
from abc import abstractmethod
from moe.bandit.bandit_interface import BanditInterfac... | en | 0.666215 | # -*- coding: utf-8 -*- Classes (Python) to compute the Bandit UCB (Upper Confidence Bound) arm allocation and choosing the arm to pull next. See :mod:`moe.bandit.bandit_interface` for further details on bandit. Implementation of the constructor of UCB (Upper Confidence Bound) and method allocate_arms. The method get_... | 3.511765 | 4 |
Hedge/Shell.py | RonaldoAPSD/Hedge | 2 | 2215 | <reponame>RonaldoAPSD/Hedge
import Hedge
while True:
text = input('Hedge > ')
if text.strip() == "":
continue
result, error = Hedge.run('<stdin>', text)
if (error):
print(error.asString())
elif result:
if len(result.elements) == 1:
print(repr(result.elements[0]))
else:
print(repr(resu... | import Hedge
while True:
text = input('Hedge > ')
if text.strip() == "":
continue
result, error = Hedge.run('<stdin>', text)
if (error):
print(error.asString())
elif result:
if len(result.elements) == 1:
print(repr(result.elements[0]))
else:
print(repr(result)) | none | 1 | 3.192692 | 3 | |
yt/frontends/enzo/io.py | Xarthisius/yt | 1 | 2216 | import numpy as np
from yt.geometry.selection_routines import GridSelector
from yt.utilities.io_handler import BaseIOHandler
from yt.utilities.logger import ytLogger as mylog
from yt.utilities.on_demand_imports import _h5py as h5py
_convert_mass = ("particle_mass", "mass")
_particle_position_names = {}
class IOHan... | import numpy as np
from yt.geometry.selection_routines import GridSelector
from yt.utilities.io_handler import BaseIOHandler
from yt.utilities.logger import ytLogger as mylog
from yt.utilities.on_demand_imports import _h5py as h5py
_convert_mass = ("particle_mass", "mass")
_particle_position_names = {}
class IOHan... | en | 0.940807 | # NOTE: This won't work with 1D datasets or references. # For all versions of Enzo I know about, we can assume all floats # are of the same size. So, let's grab one. # Now, if everything we saw was the same dtype, we can go ahead and # set it here. We do this because it is a HUGE savings for 32 bit # floats, since ou... | 2.12485 | 2 |
cidr_enum.py | arisada/cidr_enum | 0 | 2217 | <gh_stars>0
#!/usr/bin/env python3
"""
cidr_enum.py is a very simple tool to help enumerate IP ranges when being used with other tools
"""
import argparse
import netaddr
def enum_ranges(ranges, do_sort):
cidrs=[]
for r in ranges:
try:
cidrs.append(netaddr.IPNetwork(r))
except Exception as e:
print("Error... | #!/usr/bin/env python3
"""
cidr_enum.py is a very simple tool to help enumerate IP ranges when being used with other tools
"""
import argparse
import netaddr
def enum_ranges(ranges, do_sort):
cidrs=[]
for r in ranges:
try:
cidrs.append(netaddr.IPNetwork(r))
except Exception as e:
print("Error:", e)
re... | en | 0.666752 | #!/usr/bin/env python3 cidr_enum.py is a very simple tool to help enumerate IP ranges when being used with other tools #print(cidrs) | 3.546714 | 4 |
configs/k400-fixmatch-tg-alignment-videos-ptv-simclr/8gpu/r3d_r18_8x8x1_45e_k400_rgb_offlinetg_1percent_align0123_1clip_no_contrast_precisebn_ptv.py | lambert-x/video_semisup | 0 | 2218 | # model settings
model = dict(
type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D',
backbone=dict(
type='ResNet3d',
depth=18,
pretrained=None,
pretrained2d=False,
norm_eval=False,
conv_cfg=dict(type='Conv3d'),
norm_cfg=dict(type='SyncBN', requires... | # model settings
model = dict(
type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D',
backbone=dict(
type='ResNet3d',
depth=18,
pretrained=None,
pretrained2d=False,
norm_eval=False,
conv_cfg=dict(type='Conv3d'),
norm_cfg=dict(type='SyncBN', requires... | en | 0.780194 | # model settings # dataset settings # dataset_type_appearance = 'RawframeDataset_withAPP' # Get the frame and resize, shared by both weak and strong # Only used for strong augmentation # Formating the input tensors, shared by both weak and strong # NOTE: Need to reduce batch size. 16 -> 5 # Default: 4 # optimizer # thi... | 1.713774 | 2 |
experiments/rpi/gertboard/dtoa.py | willingc/pingo | 0 | 2219 | <gh_stars>0
#!/usr/bin/python2.7
# Python 2.7 version by <NAME> of http://RasPi.TV
# functionally equivalent to the Gertboard dtoa test by <NAME> & <NAME>
# Use at your own risk - I'm pretty sure the code is harmless, but check it yourself.
# This will not work unless you have installed py-spidev as in the README.txt ... | #!/usr/bin/python2.7
# Python 2.7 version by <NAME> of http://RasPi.TV
# functionally equivalent to the Gertboard dtoa test by <NAME> & <NAME>
# Use at your own risk - I'm pretty sure the code is harmless, but check it yourself.
# This will not work unless you have installed py-spidev as in the README.txt file
# spi m... | en | 0.877089 | #!/usr/bin/python2.7 # Python 2.7 version by <NAME> of http://RasPi.TV # functionally equivalent to the Gertboard dtoa test by <NAME> & <NAME> # Use at your own risk - I'm pretty sure the code is harmless, but check it yourself. # This will not work unless you have installed py-spidev as in the README.txt file # spi mu... | 2.99022 | 3 |
modules/statusbar.py | themilkman/GitGutter | 0 | 2220 | <gh_stars>0
# -*- coding: utf-8 -*-
import sublime
from . import blame
from . import templates
class SimpleStatusBarTemplate(object):
"""A simple template class with the same interface as jinja2's one."""
# a list of variables used by this template
variables = frozenset([
'repo', 'branch', 'comp... | # -*- coding: utf-8 -*-
import sublime
from . import blame
from . import templates
class SimpleStatusBarTemplate(object):
"""A simple template class with the same interface as jinja2's one."""
# a list of variables used by this template
variables = frozenset([
'repo', 'branch', 'compare', 'inser... | en | 0.730851 | # -*- coding: utf-8 -*- A simple template class with the same interface as jinja2's one. # a list of variables used by this template Format the status bar text using a static set of rules. Arguments: repo (string): The repository name branch (string): The branch name. compar... | 2.818206 | 3 |
polls/tests.py | bunya017/Django-Polls-App | 0 | 2221 | <reponame>bunya017/Django-Polls-App<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
class RandomTestCase(TestCase):
def test_one_plus_one1(self):
self.assertEqual(1+1, 2)
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
class RandomTestCase(TestCase):
def test_one_plus_one1(self):
self.assertEqual(1+1, 2) | en | 0.769321 | # -*- coding: utf-8 -*- | 2.110195 | 2 |
test.py | LeonHodgesAustin/video_stream_processor | 0 | 2222 | <gh_stars>0
# import logging
# import hercules.lib.util.hercules_logging as l
# from hercules.lib.util import sso as sso
import opencv2 as cv2
import urllib
import numpy as np
# log = l.setup_logging(__name__)
def main(args=None):
# username, passowrd = sso.get_login_credentials("WATCHER")
# Open a sample vid... | # import logging
# import hercules.lib.util.hercules_logging as l
# from hercules.lib.util import sso as sso
import opencv2 as cv2
import urllib
import numpy as np
# log = l.setup_logging(__name__)
def main(args=None):
# username, passowrd = sso.get_login_credentials("WATCHER")
# Open a sample video available... | en | 0.596891 | # import logging # import hercules.lib.util.hercules_logging as l # from hercules.lib.util import sso as sso # log = l.setup_logging(__name__) # username, passowrd = sso.get_login_credentials("WATCHER") # Open a sample video available in sample-videos #if not vcap.isOpened(): # print "File Cannot be Opened" # Captur... | 2.791036 | 3 |
ribbon/exceptions.py | cloutiertyler/RibbonGraph | 2 | 2223 | <filename>ribbon/exceptions.py
from rest_framework.exceptions import APIException
from rest_framework import status
class GraphAPIError(APIException):
"""Base class for exceptions in this module."""
pass
class NodeNotFoundError(GraphAPIError):
status_code = status.HTTP_404_NOT_FOUND
def __init__(se... | <filename>ribbon/exceptions.py
from rest_framework.exceptions import APIException
from rest_framework import status
class GraphAPIError(APIException):
"""Base class for exceptions in this module."""
pass
class NodeNotFoundError(GraphAPIError):
status_code = status.HTTP_404_NOT_FOUND
def __init__(se... | en | 0.60304 | Base class for exceptions in this module. Creating a node requires a type. | 2.749241 | 3 |
kobe-trading-bot/app.py | LeonardoM011/kobe-trading-bot | 0 | 2224 | #!/usr/bin/env python3
# Crypto trading bot using binance api
# Author: LeonardoM011<<EMAIL>>
# Created on 2021-02-05 21:56
# Set constants here:
DELTA_TIME = 300 # How long can we check for setting up new trade (in seconds)
# ----------------------
# Imports:
import os
import sys
import time as t
... | #!/usr/bin/env python3
# Crypto trading bot using binance api
# Author: LeonardoM011<<EMAIL>>
# Created on 2021-02-05 21:56
# Set constants here:
DELTA_TIME = 300 # How long can we check for setting up new trade (in seconds)
# ----------------------
# Imports:
import os
import sys
import time as t
... | en | 0.420215 | #!/usr/bin/env python3 # Crypto trading bot using binance api # Author: LeonardoM011<<EMAIL>> # Created on 2021-02-05 21:56 # Set constants here: # How long can we check for setting up new trade (in seconds) # ---------------------- # Imports: # Adding python-binance to path and importing python-binance # Globals: # Ma... | 2.984451 | 3 |
imported_files/plotting_edh01.py | SoumyaShreeram/Locating_AGN_in_DM_halos | 0 | 2225 | <filename>imported_files/plotting_edh01.py
# -*- coding: utf-8 -*-
"""Plotting.py for notebook 01_Exploring_DM_Halos
This python file contains all the functions used for plotting graphs and maps in the 1st notebook (.ipynb) of the repository: 01. Exploring parameters in DM halos and sub-halos
Script written by: <NAME... | <filename>imported_files/plotting_edh01.py
# -*- coding: utf-8 -*-
"""Plotting.py for notebook 01_Exploring_DM_Halos
This python file contains all the functions used for plotting graphs and maps in the 1st notebook (.ipynb) of the repository: 01. Exploring parameters in DM halos and sub-halos
Script written by: <NAME... | en | 0.789962 | # -*- coding: utf-8 -*- Plotting.py for notebook 01_Exploring_DM_Halos This python file contains all the functions used for plotting graphs and maps in the 1st notebook (.ipynb) of the repository: 01. Exploring parameters in DM halos and sub-halos Script written by: <NAME> Project supervised by <NAME> Date created:... | 2.416063 | 2 |
asv_bench/benchmarks/omnisci/io.py | Rubtsowa/modin | 0 | 2226 | <gh_stars>0
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); y... | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | en | 0.840542 | # Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u... | 1.886842 | 2 |
benchmarks/rotation/rotated_cifar.py | ypeng22/ProgLearn | 1 | 2227 | import matplotlib.pyplot as plt
import random
import pickle
from skimage.transform import rotate
from scipy import ndimage
from skimage.util import img_as_ubyte
from joblib import Parallel, delayed
from sklearn.ensemble.forest import _generate_unsampled_indices
from sklearn.ensemble.forest import _generate_sample_indic... | import matplotlib.pyplot as plt
import random
import pickle
from skimage.transform import rotate
from scipy import ndimage
from skimage.util import img_as_ubyte
from joblib import Parallel, delayed
from sklearn.ensemble.forest import _generate_unsampled_indices
from sklearn.ensemble.forest import _generate_sample_indic... | en | 0.197562 | #np.roll(idx[i],(cv-1)*100) #change data angle for second task #print(image_aug.shape) ### MAIN HYPERPARAMS ### ######################## | 1.921422 | 2 |
sklearn_pandas/transformers/monitor.py | toddbenanzer/sklearn_pandas | 0 | 2228 | import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin, clone
from sklearn_pandas.util import validate_dataframe
class MonitorMixin(object):
def print_message(self, message):
if self.logfile:
with open(self.logfile, "a") as fout:
fout.w... | import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin, clone
from sklearn_pandas.util import validate_dataframe
class MonitorMixin(object):
def print_message(self, message):
if self.logfile:
with open(self.logfile, "a") as fout:
fout.w... | none | 1 | 2.758886 | 3 | |
Packs/ProofpointThreatResponse/Integrations/ProofpointThreatResponse/ProofpointThreatResponse_test.py | cbrake1/content | 1 | 2229 | import pytest
from CommonServerPython import *
from ProofpointThreatResponse import create_incident_field_context, get_emails_context, pass_sources_list_filter, \
pass_abuse_disposition_filter, filter_incidents, prepare_ingest_alert_request_body, \
get_incidents_batch_by_time_request, get_new_incidents, get_tim... | import pytest
from CommonServerPython import *
from ProofpointThreatResponse import create_incident_field_context, get_emails_context, pass_sources_list_filter, \
pass_abuse_disposition_filter, filter_incidents, prepare_ingest_alert_request_body, \
get_incidents_batch_by_time_request, get_new_incidents, get_tim... | en | 0.885276 | Given - a dict of params given to the function which is gathered originally from demisto.params() The dict includes the relevant params for the fetch e.g. fetch_delta, fetch_limit, created_after, state. - response of the api When - a single iteration of the fetch is activated with a fetch li... | 1.989547 | 2 |
macholib/macho_methname.py | l1haoyuan/macholib | 0 | 2230 | import sys
import os
import json
from enum import Enum
from .mach_o import LC_SYMTAB
from macholib import MachO
from macholib import mach_o
from shutil import copy2
from shutil import SameFileError
class ReplaceType(Enum):
objc_methname = 1
symbol_table = 2
def replace_in_bytes(method_bytes, name_dict, type... | import sys
import os
import json
from enum import Enum
from .mach_o import LC_SYMTAB
from macholib import MachO
from macholib import mach_o
from shutil import copy2
from shutil import SameFileError
class ReplaceType(Enum):
objc_methname = 1
symbol_table = 2
def replace_in_bytes(method_bytes, name_dict, type... | en | 0.916457 | Map method names in Mach-O file with the JSON file | 2.401683 | 2 |
archive/data-processing/archive/features/sd1.py | FloFincke/affective-chat | 0 | 2231 | <gh_stars>0
#!/usr/bin/env python
import math
import numpy as np
def sd1(rr):
sdnn = np.std(rr)
return math.sqrt(0.5 * sdnn * sdnn) | #!/usr/bin/env python
import math
import numpy as np
def sd1(rr):
sdnn = np.std(rr)
return math.sqrt(0.5 * sdnn * sdnn) | ru | 0.26433 | #!/usr/bin/env python | 2.717125 | 3 |
forms/snippets/delete_watch.py | soheilv/python-samples | 255 | 2232 | # 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, ... | # 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, ... | en | 0.858148 | # 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.244252 | 2 |
data_structures/disjoint_set/disjoint_set.py | egagraha/python-algorithm | 0 | 2233 | <gh_stars>0
"""
Disjoint set.
Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure
"""
class Node:
def __init__(self, data: int) -> None:
self.data = data
self.rank: int
self.parent: Node
def make_set(x: Node) -> None:
"""
Make x as a set.
"""
# ra... | """
Disjoint set.
Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure
"""
class Node:
def __init__(self, data: int) -> None:
self.data = data
self.rank: int
self.parent: Node
def make_set(x: Node) -> None:
"""
Make x as a set.
"""
# rank is the di... | en | 0.842022 | Disjoint set. Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure Make x as a set. # rank is the distance from x to its' parent # root's rank is 0 Union of two sets. set with bigger rank should be parent, so that the disjoint set tree will be more flat. Return the parent of x Return a Pytho... | 4.264073 | 4 |
cw_EPR.py | tkeller12/spin_physics | 0 | 2234 | # <NAME>
# S = 1/2, I = 1/2
# Spin 1/2 electron coupled to spin 1/2 nuclei
import numpy as np
from scipy.linalg import expm
from matplotlib.pylab import *
from matplotlib import cm
sigma_x = 0.5*np.r_[[[0, 1],[1, 0]]]
sigma_y = 0.5*np.r_[[[0,-1j],[1j, 0]]]
sigma_z = 0.5*np.r_[[[1, 0],[0, -1]]]
Identity = np.eye(2)
... | # <NAME>
# S = 1/2, I = 1/2
# Spin 1/2 electron coupled to spin 1/2 nuclei
import numpy as np
from scipy.linalg import expm
from matplotlib.pylab import *
from matplotlib import cm
sigma_x = 0.5*np.r_[[[0, 1],[1, 0]]]
sigma_y = 0.5*np.r_[[[0,-1j],[1j, 0]]]
sigma_z = 0.5*np.r_[[[1, 0],[0, -1]]]
Identity = np.eye(2)
... | en | 0.444327 | # <NAME> # S = 1/2, I = 1/2 # Spin 1/2 electron coupled to spin 1/2 nuclei # rad / (s * T) # rad / (s * T) # Isotropic Hyperfine coupling rad / s # T #H = omega_S/(2.*np.pi)*B0*Sz + omega_I/(2.*np.pi)*B0*Iz + Aiso * (np.dot(Sx,Ix) + np.dot(Sy,Iy) + np.dot(Sz,Iz)) | 2.174738 | 2 |
V2RaycSpider0825/MiddleKey/VMes_IO.py | TOMJERRY23333/V2RayCloudSpider | 1 | 2235 | from spiderNest.preIntro import *
path_ = os.path.dirname(os.path.dirname(__file__)) + '/dataBase/log_information.csv'
def save_login_info(VMess, class_):
"""
VMess入库
class_: ssr or v2ray
"""
now = str(datetime.now()).split('.')[0]
with open(path_, 'a', encoding='utf-8', newline='') as f:
... | from spiderNest.preIntro import *
path_ = os.path.dirname(os.path.dirname(__file__)) + '/dataBase/log_information.csv'
def save_login_info(VMess, class_):
"""
VMess入库
class_: ssr or v2ray
"""
now = str(datetime.now()).split('.')[0]
with open(path_, 'a', encoding='utf-8', newline='') as f:
... | zh | 0.192555 | VMess入库 class_: ssr or v2ray # 入库时间,Vmess,初始化状态:0 获取可用订阅链接并刷新存储池 class_: ssr ; v2ray # ['2020-08-06 04:27:59', 'link','class_', '1'] #{}'.format(bei_ing_time, vm[-2]) # return vm_q.__len__() | 2.534083 | 3 |
paddlespeech/s2t/frontend/audio.py | AK391/PaddleSpeech | 0 | 2236 | <reponame>AK391/PaddleSpeech
# Copyright (c) 2021 PaddlePaddle 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... | # Copyright (c) 2021 PaddlePaddle 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 appli... | en | 0.760731 | # Copyright (c) 2021 PaddlePaddle 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 appli... | 2.330946 | 2 |
tornado_debugger/debug.py | bhch/tornado-debugger | 1 | 2237 | import os.path
import re
import sys
import traceback
from pprint import pformat
import tornado
from tornado import template
SENSITIVE_SETTINGS_RE = re.compile(
'api|key|pass|salt|secret|signature|token',
flags=re.IGNORECASE
)
class ExceptionReporter:
def __init__(self, exc_info, handler):
self.... | import os.path
import re
import sys
import traceback
from pprint import pformat
import tornado
from tornado import template
SENSITIVE_SETTINGS_RE = re.compile(
'api|key|pass|salt|secret|signature|token',
flags=re.IGNORECASE
)
class ExceptionReporter:
def __init__(self, exc_info, handler):
self.... | en | 0.915225 | # could not open file # Avoid infinite loop if there's a cyclic reference (#29393). # No exceptions were supplied to ExceptionReporter # In case there's just one exception, take the traceback from self.tb | 2.17649 | 2 |
base/pylib/seq_iter.py | jpolitz/lambda-py-paper | 1 | 2238 | class SeqIter:
def __init__(self,l):
self.l = l
self.i = 0
self.stop = False
def __len__(self):
return len(self.l)
def __list__(self):
l = []
while True:
try:
l.append(self.__next__())
except StopIteration:
... | class SeqIter:
def __init__(self,l):
self.l = l
self.i = 0
self.stop = False
def __len__(self):
return len(self.l)
def __list__(self):
l = []
while True:
try:
l.append(self.__next__())
except StopIteration:
... | none | 1 | 3.284796 | 3 | |
caseworker/open_general_licences/enums.py | code-review-doctor/lite-frontend-1 | 0 | 2239 | <reponame>code-review-doctor/lite-frontend-1
from lite_content.lite_internal_frontend.open_general_licences import (
OGEL_DESCRIPTION,
OGTCL_DESCRIPTION,
OGTL_DESCRIPTION,
)
from lite_forms.components import Option
class OpenGeneralExportLicences:
class OpenGeneralLicence:
def __init__(self, i... | from lite_content.lite_internal_frontend.open_general_licences import (
OGEL_DESCRIPTION,
OGTCL_DESCRIPTION,
OGTL_DESCRIPTION,
)
from lite_forms.components import Option
class OpenGeneralExportLicences:
class OpenGeneralLicence:
def __init__(self, id, name, description, acronym):
s... | none | 1 | 1.978932 | 2 | |
Matrix/Python/rotatematrix.py | pratika1505/DSA-Path-And-Important-Questions | 26 | 2240 | # -*- coding: utf-8 -*-
"""RotateMatrix.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1LX-dZFuQCyBXDNVosTp0MHaZZxoc5T4I
"""
#Function to rotate matrix by 90 degree
def rotate(mat):
# `N × N` matrix
N = len(mat)
# Transpose the m... | # -*- coding: utf-8 -*-
"""RotateMatrix.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1LX-dZFuQCyBXDNVosTp0MHaZZxoc5T4I
"""
#Function to rotate matrix by 90 degree
def rotate(mat):
# `N × N` matrix
N = len(mat)
# Transpose the m... | en | 0.853942 | # -*- coding: utf-8 -*- RotateMatrix.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1LX-dZFuQCyBXDNVosTp0MHaZZxoc5T4I #Function to rotate matrix by 90 degree # `N × N` matrix # Transpose the matrix # swap columns #Declaring matrix #printing matri... | 4.088634 | 4 |
sort.py | EYH0602/FP_Workshop | 1 | 2241 | <gh_stars>1-10
def quicksort(xs):
if len(xs) == 0:
return []
pivot = xs[0]
xs = xs[1:]
left = [x for x in xs if x <= pivot]
right = [x for x in xs if x > pivot]
res = quicksort(left)
res.append(pivot)
res += quicksort(right)
return res
xs = [1, 3, 2, 4, 5, 2]
sorted_xs = ... | def quicksort(xs):
if len(xs) == 0:
return []
pivot = xs[0]
xs = xs[1:]
left = [x for x in xs if x <= pivot]
right = [x for x in xs if x > pivot]
res = quicksort(left)
res.append(pivot)
res += quicksort(right)
return res
xs = [1, 3, 2, 4, 5, 2]
sorted_xs = quicksort(xs) | none | 1 | 3.962194 | 4 | |
bddtests/steps/bdd_test_util.py | TarantulaTechnology/fabric5 | 4 | 2242 | <reponame>TarantulaTechnology/fabric5
# Copyright IBM Corp. 2016 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
#
# ... | # Copyright IBM Corp. 2016 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 applicable law or ag... | en | 0.77214 | # Copyright IBM Corp. 2016 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 applicable law or ag... | 2.160204 | 2 |
1.0.0/hp/dict.py | cefect/SOFDA0 | 0 | 2243 | '''
Created on Mar 6, 2018
@author: cef
hp functions for workign with dictionaries
'''
import logging, os, sys, math, copy, inspect
from collections import OrderedDict
from weakref import WeakValueDictionary as wdict
import numpy as np
import hp.basic
mod_logger = logging.getLogger(__name__) #... | '''
Created on Mar 6, 2018
@author: cef
hp functions for workign with dictionaries
'''
import logging, os, sys, math, copy, inspect
from collections import OrderedDict
from weakref import WeakValueDictionary as wdict
import numpy as np
import hp.basic
mod_logger = logging.getLogger(__name__) #... | en | 0.453631 | Created on Mar 6, 2018
@author: cef
hp functions for workign with dictionaries #creates a child logger of the root #log each value of the dictionary to fille #return the intersection of the dict.keys() and the key_list #=========================================================================== # pre check #=====... | 2.723949 | 3 |
Core/pre.py | Cyber-Dioxide/CyberPhish | 9 | 2244 | <reponame>Cyber-Dioxide/CyberPhish<filename>Core/pre.py
import os
import random
try:
from colorama import Fore, Style
except ModuleNotFoundError:
os.system("pip install colorama")
from urllib.request import urlopen
from Core.helper.color import green, white, blue, red, start, alert
Version = "2.2"
yellow = ("\033[1... | import os
import random
try:
from colorama import Fore, Style
except ModuleNotFoundError:
os.system("pip install colorama")
from urllib.request import urlopen
from Core.helper.color import green, white, blue, red, start, alert
Version = "2.2"
yellow = ("\033[1;33;40m")
def connected(host='http://duckduckgo.com'):... | none | 1 | 2.560623 | 3 | |
automatoes/authorize.py | candango/automatoes | 13 | 2245 | <filename>automatoes/authorize.py
#!/usr/bin/env python
#
# Copyright 2019-2020 <NAME>
# Copyright 2016-2017 <NAME> under MIT License
#
# 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
#
# ht... | <filename>automatoes/authorize.py
#!/usr/bin/env python
#
# Copyright 2019-2020 <NAME>
# Copyright 2016-2017 <NAME> under MIT License
#
# 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
#
# ht... | en | 0.79005 | #!/usr/bin/env python # # Copyright 2019-2020 <NAME> # Copyright 2016-2017 <NAME> under MIT License # # 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/LICEN... | 2.357211 | 2 |
rllib/agents/dqn/simple_q_torch_policy.py | jamesliu/ray | 3 | 2246 | <gh_stars>1-10
"""PyTorch policy class used for Simple Q-Learning"""
import logging
from typing import Dict, Tuple
import gym
import ray
from ray.rllib.agents.dqn.simple_q_tf_policy import (
build_q_models, compute_q_values, get_distribution_inputs_and_class)
from ray.rllib.models.modelv2 import ModelV2
from ray.... | """PyTorch policy class used for Simple Q-Learning"""
import logging
from typing import Dict, Tuple
import gym
import ray
from ray.rllib.agents.dqn.simple_q_tf_policy import (
build_q_models, compute_q_values, get_distribution_inputs_and_class)
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.to... | en | 0.79888 | PyTorch policy class used for Simple Q-Learning Assign the `update_target` method to the SimpleQTorchPolicy The function is called every `target_network_update_freq` steps by the master learner. # Hard initial update from Q-net(s) to target Q-net(s). # Update_target_fn will be called periodically to copy Q net... | 2.400731 | 2 |
viphoneme/T2IPA.py | NoahDrisort/ViSV2TTS | 1 | 2247 | #Grapheme
Rime_tone=[ "a","ă","â","e","ê","i","o","ô","ơ","u","ư","y","iê","oa","oă","oe","oo","uâ","uê","uô","uơ","uy","ươ","uyê","yê", #blank
"á","ắ","ấ","é","ế","í","ó","ố","ớ","ú","ứ","ý","iế","óa","oắ","óe","oó","uấ","uế","uố","ướ","úy","ướ","uyế","yế", #grave
... | #Grapheme
Rime_tone=[ "a","ă","â","e","ê","i","o","ô","ơ","u","ư","y","iê","oa","oă","oe","oo","uâ","uê","uô","uơ","uy","ươ","uyê","yê", #blank
"á","ắ","ấ","é","ế","í","ó","ố","ớ","ú","ứ","ý","iế","óa","oắ","óe","oó","uấ","uế","uố","ướ","úy","ướ","uyế","yế", #grave
... | en | 0.348317 | #Grapheme #blank #grave #acute #hook #tilde #dot #coding: utf-8 #Custom phoneme follow the https://vi.wikipedia.org/wiki/%C3%82m_v%E1%BB%8B_h%E1%BB%8Dc_ti%E1%BA%BFng_Vi%E1%BB%87t #Improve pronoune between N C S #u'uy' : u'uj', u'úy' : u'uj', u'ùy' : u'uj', u'ủy' : u'uj', u'ũy' : u'uj', u'ụy' : u'uj', #thay để hạn chế t... | 1.389016 | 1 |
taskengine/sessions.py | retmas-dv/deftcore | 0 | 2248 | <filename>taskengine/sessions.py
__author__ = '<NAME>'
from django.contrib.sessions.base_session import AbstractBaseSession
from django.contrib.sessions.backends.db import SessionStore as DBStore
class CustomSession(AbstractBaseSession):
@classmethod
def get_session_store_class(cls):
return SessionSt... | <filename>taskengine/sessions.py
__author__ = '<NAME>'
from django.contrib.sessions.base_session import AbstractBaseSession
from django.contrib.sessions.backends.db import SessionStore as DBStore
class CustomSession(AbstractBaseSession):
@classmethod
def get_session_store_class(cls):
return SessionSt... | none | 1 | 2.042032 | 2 | |
tests/assignments/test_assign7.py | acc-cosc-1336/cosc-1336-spring-2018-vcruz350 | 0 | 2249 | import unittest
#write the import for function for assignment7 sum_list_values
from src.assignments.assignment7 import sum_list_values
class Test_Assign7(unittest.TestCase):
def sample_test(self):
self.assertEqual(1,1)
#create a test for the sum_list_values function with list elements:
# bill 23 ... | import unittest
#write the import for function for assignment7 sum_list_values
from src.assignments.assignment7 import sum_list_values
class Test_Assign7(unittest.TestCase):
def sample_test(self):
self.assertEqual(1,1)
#create a test for the sum_list_values function with list elements:
# bill 23 ... | en | 0.316969 | #write the import for function for assignment7 sum_list_values #create a test for the sum_list_values function with list elements: # bill 23 16 19 22 #unittest.main(verbosity=2) | 3.43153 | 3 |
setec/__init__.py | kgriffs/setec | 0 | 2250 | <filename>setec/__init__.py<gh_stars>0
# Copyright 2018 by <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | <filename>setec/__init__.py<gh_stars>0
# Copyright 2018 by <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | en | 0.76094 | # Copyright 2018 by <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof... | 2.055047 | 2 |
blender/arm/logicnode/native/LN_detect_mobile_browser.py | niacdoial/armory | 0 | 2251 | from arm.logicnode.arm_nodes import *
class DetectMobileBrowserNode(ArmLogicTreeNode):
"""Determines the mobile browser or not (works only for web browsers)."""
bl_idname = 'LNDetectMobileBrowserNode'
bl_label = 'Detect Mobile Browser'
arm_version = 1
def init(self, context):
super(DetectMobileBrowserNode, sel... | from arm.logicnode.arm_nodes import *
class DetectMobileBrowserNode(ArmLogicTreeNode):
"""Determines the mobile browser or not (works only for web browsers)."""
bl_idname = 'LNDetectMobileBrowserNode'
bl_label = 'Detect Mobile Browser'
arm_version = 1
def init(self, context):
super(DetectMobileBrowserNode, sel... | en | 0.585652 | Determines the mobile browser or not (works only for web browsers). | 2.381102 | 2 |
corehq/apps/dump_reload/tests/test_sql_dump_load.py | andyasne/commcare-hq | 471 | 2252 | <gh_stars>100-1000
import inspect
import json
import uuid
from collections import Counter
from datetime import datetime
from io import StringIO
import mock
from django.contrib.admin.utils import NestedObjects
from django.db import transaction, IntegrityError
from django.db.models.signals import post_delete, post_save
... | import inspect
import json
import uuid
from collections import Counter
from datetime import datetime
from io import StringIO
import mock
from django.contrib.admin.utils import NestedObjects
from django.db import transaction, IntegrityError
from django.db.models.signals import post_delete, post_save
from django.test im... | en | 0.848618 | # make sure that there's no data left in the DB # Dump # Load Ensure that any post_save signal handlers have been updated to handle 'raw' calls. # match ID in devicelog.xml Blocks when sending 'test3' Blocks when sending ``None`` into the queue to 'terminate' it. # resave the product to force an error # patch t... | 1.382171 | 1 |
tests/keras/test_activations.py | the-moliver/keras | 150 | 2253 | import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras import backend as K
from keras import activations
def get_standard_values():
'''
These are just a set of floats used for testing the activation
functions, and are useful in multiple tests.
'''
return np.array([[... | import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras import backend as K
from keras import activations
def get_standard_values():
'''
These are just a set of floats used for testing the activation
functions, and are useful in multiple tests.
'''
return np.array([[... | en | 0.709459 | These are just a set of floats used for testing the activation functions, and are useful in multiple tests. Test using a reference implementation of softmax Test using a reference softplus implementation Test using a reference softsign implementation Test using a numerically stable reference sigmoid implementation ... | 2.879076 | 3 |
scripts/H5toXMF.py | robertsawko/proteus | 0 | 2254 |
#import numpy
#import os
#from xml.etree.ElementTree import *
import tables
#from Xdmf import *
def H5toXMF(basename,size,start,finaltime,stride):
# Open XMF files
for step in range(start,finaltime+1,stride):
XMFfile = open(basename+"."+str(step)+".xmf","w")
XMFfile.write(r"""<?xml version="1.0... |
#import numpy
#import os
#from xml.etree.ElementTree import *
import tables
#from Xdmf import *
def H5toXMF(basename,size,start,finaltime,stride):
# Open XMF files
for step in range(start,finaltime+1,stride):
XMFfile = open(basename+"."+str(step)+".xmf","w")
XMFfile.write(r"""<?xml version="1.0... | en | 0.209646 | #import numpy #import os #from xml.etree.ElementTree import * #from Xdmf import * # Open XMF files <?xml version="1.0" ?> <!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []> <Xdmf Version="2.0" xmlns:xi="http://www.w3.org/2001/XInclude"> <Domain> | 2.412333 | 2 |
tests/test_cli/test_generate/test_generate.py | lrahmani/agents-aea | 0 | 2255 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | en | 0.698486 | # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ... | 1.960277 | 2 |
sphinx/ext/napoleon/__init__.py | PeerHerholz/smobsc | 3 | 2256 | """
sphinx.ext.napoleon
~~~~~~~~~~~~~~~~~~~
Support for NumPy and Google style docstrings.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from sphinx import __display_version__ as __version__
from sphinx.application import Sphinx
from ... | """
sphinx.ext.napoleon
~~~~~~~~~~~~~~~~~~~
Support for NumPy and Google style docstrings.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from sphinx import __display_version__ as __version__
from sphinx.application import Sphinx
from ... | en | 0.671206 | sphinx.ext.napoleon ~~~~~~~~~~~~~~~~~~~ Support for NumPy and Google style docstrings. :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. # For type annotation # NOQA Sphinx napoleon extension settings in `conf.py`. Listed below are all the se... | 1.725595 | 2 |
plugins/similarity/rdkit/tanimoto/lbvs-entry.py | skodapetr/viset | 1 | 2257 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from rdkit import DataStructs
import plugin_api
__license__ = "X11"
class LbvsEntry(plugin_api.PluginInterface):
"""
Compute Tanimoto similarity.
"""
def __init__(self):
self.stream = None
self.counter = 0
self.first_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from rdkit import DataStructs
import plugin_api
__license__ = "X11"
class LbvsEntry(plugin_api.PluginInterface):
"""
Compute Tanimoto similarity.
"""
def __init__(self):
self.stream = None
self.counter = 0
self.first_... | en | 0.649868 | #!/usr/bin/env python # -*- coding: utf-8 -*- Compute Tanimoto similarity. # Use max integer value as a size. | 2.445358 | 2 |
mall_spider/spiders/actions/proxy_service.py | 524243642/taobao_spider | 12 | 2258 | <gh_stars>10-100
# coding: utf-8
import time
from config.config_loader import global_config
from mall_spider.spiders.actions.context import Context
from mall_spider.spiders.actions.direct_proxy_action import DirectProxyAction
__proxy_service = None
class ProxyService(object):
proxies_set = set()
proxies_lis... | # coding: utf-8
import time
from config.config_loader import global_config
from mall_spider.spiders.actions.context import Context
from mall_spider.spiders.actions.direct_proxy_action import DirectProxyAction
__proxy_service = None
class ProxyService(object):
proxies_set = set()
proxies_list = ['https://' +... | en | 0.833554 | # coding: utf-8 | 2.151824 | 2 |
app/weather_tests.py | joedanz/flask-weather | 1 | 2259 | import os
import weather
import datetime
import unittest
import tempfile
class WeatherTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, weather.app.config['DATABASE'] = tempfile.mkstemp()
weather.app.config['TESTING'] = True
self.app = weather.app.test_client()
weather.init... | import os
import weather
import datetime
import unittest
import tempfile
class WeatherTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, weather.app.config['DATABASE'] = tempfile.mkstemp()
weather.app.config['TESTING'] = True
self.app = weather.app.test_client()
weather.init... | en | 0.940795 | Test empty database with no entries. Test reporting weather Test reporting weather | 2.781477 | 3 |
modules/sensors/Activator.py | memristor/mep2 | 5 | 2260 | import asyncio
class Activator:
def __init__(self, name, packet_stream=None):
self.ps = None
self.name = name
self.future = None
self.data = 0
self.state = ''
if packet_stream:
self.set_packet_stream(packet_stream)
@_core.module_cmd
def wait_activator(self):
pass
@_core.module_cmd
def check... | import asyncio
class Activator:
def __init__(self, name, packet_stream=None):
self.ps = None
self.name = name
self.future = None
self.data = 0
self.state = ''
if packet_stream:
self.set_packet_stream(packet_stream)
@_core.module_cmd
def wait_activator(self):
pass
@_core.module_cmd
def check... | none | 1 | 2.557787 | 3 | |
examples/retrieval/evaluation/sparse/evaluate_deepct.py | ArthurCamara/beir | 24 | 2261 | <gh_stars>10-100
"""
This example shows how to evaluate DeepCT (using Anserini) in BEIR.
For more details on DeepCT, refer here: https://arxiv.org/abs/1910.10687
The original DeepCT repository is not modularised and only works with Tensorflow 1.x (1.15).
We modified the DeepCT repository to work with Tensorflow latest... | """
This example shows how to evaluate DeepCT (using Anserini) in BEIR.
For more details on DeepCT, refer here: https://arxiv.org/abs/1910.10687
The original DeepCT repository is not modularised and only works with Tensorflow 1.x (1.15).
We modified the DeepCT repository to work with Tensorflow latest (2.x).
We do not... | en | 0.586203 | This example shows how to evaluate DeepCT (using Anserini) in BEIR. For more details on DeepCT, refer here: https://arxiv.org/abs/1910.10687 The original DeepCT repository is not modularised and only works with Tensorflow 1.x (1.15). We modified the DeepCT repository to work with Tensorflow latest (2.x). We do not cha... | 2.364779 | 2 |
Examples/Space Truss - Nodal Load.py | AmirHosseinNamadchi/PyNite | 2 | 2262 | <filename>Examples/Space Truss - Nodal Load.py
# Engineering Mechanics: Statics, 4th Edition
# <NAME>
# Problem 6.64
# Units for this model are meters and kilonewtons
# Import 'FEModel3D' and 'Visualization' from 'PyNite'
from PyNite import FEModel3D
from PyNite import Visualization
# Create a new model
truss = FEMod... | <filename>Examples/Space Truss - Nodal Load.py
# Engineering Mechanics: Statics, 4th Edition
# <NAME>
# Problem 6.64
# Units for this model are meters and kilonewtons
# Import 'FEModel3D' and 'Visualization' from 'PyNite'
from PyNite import FEModel3D
from PyNite import Visualization
# Create a new model
truss = FEMod... | en | 0.882606 | # Engineering Mechanics: Statics, 4th Edition # <NAME> # Problem 6.64 # Units for this model are meters and kilonewtons # Import 'FEModel3D' and 'Visualization' from 'PyNite' # Create a new model # Define the nodes # Define the supports # Create members # Member properties were not given for this problem, so assumed va... | 2.702654 | 3 |
Using Yagmail to make sending emails easier.py | CodeMaster7000/Sending-Emails-in-Python | 1 | 2263 | import yagmail
receiver = "<EMAIL>" #Receiver's gmail address
body = "Hello there from Yagmail"
filename = "document.pdf"
yag = yagmail.SMTP("<EMAIL>")#Your gmail address
yag.send(
to=receiver,
subject="Yagmail test (attachment included",
contents=body,
attachments=filename,
)
| import yagmail
receiver = "<EMAIL>" #Receiver's gmail address
body = "Hello there from Yagmail"
filename = "document.pdf"
yag = yagmail.SMTP("<EMAIL>")#Your gmail address
yag.send(
to=receiver,
subject="Yagmail test (attachment included",
contents=body,
attachments=filename,
)
| en | 0.924868 | #Receiver's gmail address #Your gmail address | 2.295579 | 2 |
pycad/py_src/transformations.py | markendr/esys-escript.github.io | 0 | 2264 |
##############################################################################
#
# Copyright (c) 2003-2020 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unt... |
##############################################################################
#
# Copyright (c) 2003-2020 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unt... | en | 0.593961 | ############################################################################## # # Copyright (c) 2003-2020 by The University of Queensland # http://www.uq.edu.au # # Primary Business: Queensland, Australia # Licensed under the Apache License, version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # # Development unti... | 1.743831 | 2 |
example/complex_scalar_star_solver.py | ThomasHelfer/BosonStar | 2 | 2265 | <gh_stars>1-10
from bosonstar.ComplexBosonStar import Complex_Boson_Star
# =====================
# All imporntnat definitions
# =====================
# Physics defintions
phi0 = 0.40 # centeral phi
D = 5.0 # Dimension (total not only spacial)
Lambda = -0.2 # Cosmological constant
# Solver ... | from bosonstar.ComplexBosonStar import Complex_Boson_Star
# =====================
# All imporntnat definitions
# =====================
# Physics defintions
phi0 = 0.40 # centeral phi
D = 5.0 # Dimension (total not only spacial)
Lambda = -0.2 # Cosmological constant
# Solver definitions
Rst... | en | 0.636409 | # ===================== # All imporntnat definitions # ===================== # Physics defintions # centeral phi # Dimension (total not only spacial) # Cosmological constant # Solver definitions # Small epsilon to avoid r \neq 0 # ==================================== # Main routine # ================================... | 2.626524 | 3 |
setup.py | ouyhlan/fastNLP | 2,693 | 2266 | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as f:
readme = f.read()
with open('LICENSE', encoding='utf-8') as f:
license = f.read()
with open('requirements.txt', encoding='utf-8') as f:
reqs = f.read()
pkgs = [p for p in find_... | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as f:
readme = f.read()
with open('LICENSE', encoding='utf-8') as f:
license = f.read()
with open('requirements.txt', encoding='utf-8') as f:
reqs = f.read()
pkgs = [p for p in find_... | en | 0.244401 | #!/usr/bin/env python # coding=utf-8 | 1.595732 | 2 |
clients/client/python/ory_client/__init__.py | ory/sdk-generator | 0 | 2267 | <filename>clients/client/python/ory_client/__init__.py
# flake8: noqa
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI docu... | <filename>clients/client/python/ory_client/__init__.py
# flake8: noqa
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI docu... | en | 0.628344 | # flake8: noqa Ory APIs Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501 The version of the OpenAPI document: v0.0.1-alpha.187 Contact: <EMAIL> Generated by: ht... | 1.582903 | 2 |
atmosphere/custom_activity/base_class.py | ambiata/atmosphere-python-sdk | 0 | 2268 | <filename>atmosphere/custom_activity/base_class.py<gh_stars>0
from abc import ABC, abstractmethod
from typing import Tuple
from requests import Response
from .pydantic_models import (AppliedExclusionConditionsResponse,
BiasAttributeConfigListResponse,
Comput... | <filename>atmosphere/custom_activity/base_class.py<gh_stars>0
from abc import ABC, abstractmethod
from typing import Tuple
from requests import Response
from .pydantic_models import (AppliedExclusionConditionsResponse,
BiasAttributeConfigListResponse,
Comput... | en | 0.766658 | The main class of this repository: the one to be implemented Raise a ValidationError if the received prediction request is not valid Raise a ValidationError if the received outcome request is not valid From an outcome, compute the reward Return the version of the module. Send a mock request to the provided url and retu... | 2.731215 | 3 |
Module1/file3.py | modulo16/PfNE | 0 | 2269 | <reponame>modulo16/PfNE
from __future__ import print_function, unicode_literals
#Ensures Unicode is used for all strings.
my_str = 'whatever'
#Shows the String type, which should be unicode
type(my_str)
#declare string:
ip_addr = '192.168.1.1'
#check it with boolean:(True)
ip_addr == '192.168.1.1'
#(false)
ip_addr ==... | from __future__ import print_function, unicode_literals
#Ensures Unicode is used for all strings.
my_str = 'whatever'
#Shows the String type, which should be unicode
type(my_str)
#declare string:
ip_addr = '192.168.1.1'
#check it with boolean:(True)
ip_addr == '192.168.1.1'
#(false)
ip_addr == '10.1.1.1'
#is this su... | en | 0.803947 | #Ensures Unicode is used for all strings. #Shows the String type, which should be unicode #declare string: #check it with boolean:(True) #(false) #is this substring in this variable? #Strings also have indices starting at '0' #in the case below we get '1' which is the first character #we can also get the last using neg... | 3.641056 | 4 |
pp_io_plugins/pp_kbddriver_plus.py | arcticmatter/pipresents-beep | 0 | 2270 | #enhanced keyboard driver
import copy
import os
import configparser
from pp_displaymanager import DisplayManager
class pp_kbddriver_plus(object):
# control list items
NAME=0 # symbolic name for input and output
DIRECTION = 1 # in/out
MATCH = 2 # for input the charac... | #enhanced keyboard driver
import copy
import os
import configparser
from pp_displaymanager import DisplayManager
class pp_kbddriver_plus(object):
# control list items
NAME=0 # symbolic name for input and output
DIRECTION = 1 # in/out
MATCH = 2 # for input the charac... | en | 0.771904 | #enhanced keyboard driver # control list items # symbolic name for input and output # in/out # for input the character/string to match (no EOL) # for input the match mode any-char,char,any-line,line # CLASS VARIABLES (pp_kbddriver_plus.) # usd for error reporting and logging # mS between polls of the serial input # ch... | 2.485424 | 2 |
grocery/migrations/0003_alter_item_comments.py | akshay-kapase/shopping | 0 | 2271 | <filename>grocery/migrations/0003_alter_item_comments.py
# Generated by Django 3.2.6 on 2021-09-03 15:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('grocery', '0002_alter_item_comments'),
]
operations = [
migrations.AlterField(
... | <filename>grocery/migrations/0003_alter_item_comments.py
# Generated by Django 3.2.6 on 2021-09-03 15:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('grocery', '0002_alter_item_comments'),
]
operations = [
migrations.AlterField(
... | en | 0.899506 | # Generated by Django 3.2.6 on 2021-09-03 15:48 | 1.490133 | 1 |
projects/objects/buildings/protos/textures/colored_textures/textures_generator.py | yjf18340/webots | 1 | 2272 | #!/usr/bin/env python
# Copyright 1996-2019 Cyberbotics Ltd.
#
# 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... | #!/usr/bin/env python
# Copyright 1996-2019 Cyberbotics Ltd.
#
# 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.806285 | #!/usr/bin/env python # Copyright 1996-2019 Cyberbotics Ltd. # # 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 applicab... | 2.179039 | 2 |
tutorial/test_env.py | viz4biz/PyDataNYC2015 | 11 | 2273 | """
test local env
"""
import os
for k, v in os.environ.iteritems():
print k, '=', v
| """
test local env
"""
import os
for k, v in os.environ.iteritems():
print k, '=', v
| uk | 0.103601 | test local env | 2.001226 | 2 |
project2/marriage.py | filipefborba/MarriageNSFG | 0 | 2274 | <gh_stars>0
"""This file contains code for use with "Think Stats",
by <NAME>, available from greenteapress.com
Copyright 2014 <NAME>
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import bisect
import numpy as np
import pandas as pd
import scipy.stats
im... | """This file contains code for use with "Think Stats",
by <NAME>, available from greenteapress.com
Copyright 2014 <NAME>
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import bisect
import numpy as np
import pandas as pd
import scipy.stats
import gzip
im... | en | 0.75873 | This file contains code for use with "Think Stats", by <NAME>, available from greenteapress.com Copyright 2014 <NAME> License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html Resamples each dataframe and then concats them. resps: list of DataFrame returns: DataFrame # we have to resample the data from each cy... | 3.092489 | 3 |
xfel/merging/application/reflection_table_utils.py | ErwinP/cctbx_project | 0 | 2275 | <gh_stars>0
from __future__ import absolute_import, division, print_function
from six.moves import range
from dials.array_family import flex
import math
class reflection_table_utils(object):
@staticmethod
def get_next_hkl_reflection_table(reflections):
'''Generate asu hkl slices from an asu hkl-sorted reflect... | from __future__ import absolute_import, division, print_function
from six.moves import range
from dials.array_family import flex
import math
class reflection_table_utils(object):
@staticmethod
def get_next_hkl_reflection_table(reflections):
'''Generate asu hkl slices from an asu hkl-sorted reflection table'''... | en | 0.485729 | Generate asu hkl slices from an asu hkl-sorted reflection table Create a reflection table for storing merged HKLs Merge intensities of multiply-measured symmetry-reduced HKLs # unless the input "reflections" list is empty, generated "refls" lists cannot be empty # This assert is timeconsuming when using a small number ... | 2.28739 | 2 |
rpython/memory/test/test_transformed_gc.py | jptomo/pypy-lang-scheme | 1 | 2276 | <reponame>jptomo/pypy-lang-scheme
import py
import inspect
from rpython.rlib.objectmodel import compute_hash, compute_identity_hash
from rpython.translator.c import gc
from rpython.annotator import model as annmodel
from rpython.rtyper.llannotation import SomePtr
from rpython.rtyper.lltypesystem import lltype, llmemor... | import py
import inspect
from rpython.rlib.objectmodel import compute_hash, compute_identity_hash
from rpython.translator.c import gc
from rpython.annotator import model as annmodel
from rpython.rtyper.llannotation import SomePtr
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, llgroup
from rpython.memo... | en | 0.833845 | # XXX XXX XXX mess # used to let test cleanup static root pointing to runtime # allocated stuff # FIIIIISH # setup => resets the gc # crashes if constants are not considered roots #XXX pure lazyness here too #XXX pure lazyness here too # check that __del__ is not called again #XXX pure lazyness here too # # # check tha... | 1.866066 | 2 |
build/lib/rigidregistration/__init__.py | kem-group/rigidRegistration | 3 | 2277 | from . import utils
from . import display
from . import save
from . import FFTW
from . import stackregistration
__version__="0.2.1" | from . import utils
from . import display
from . import save
from . import FFTW
from . import stackregistration
__version__="0.2.1" | none | 1 | 1.087418 | 1 | |
torchmetrics/retrieval/retrieval_fallout.py | rudaoshi/metrics | 0 | 2278 | # 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... | # 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.78887 | # 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.017923 | 2 |
pydlm/tests/base/testKalmanFilter.py | onnheimm/pydlm | 423 | 2279 | <gh_stars>100-1000
import numpy as np
import unittest
from pydlm.modeler.trends import trend
from pydlm.modeler.seasonality import seasonality
from pydlm.modeler.builder import builder
from pydlm.base.kalmanFilter import kalmanFilter
class testKalmanFilter(unittest.TestCase):
def setUp(self):
self.kf1 ... | import numpy as np
import unittest
from pydlm.modeler.trends import trend
from pydlm.modeler.seasonality import seasonality
from pydlm.modeler.builder import builder
from pydlm.base.kalmanFilter import kalmanFilter
class testKalmanFilter(unittest.TestCase):
def setUp(self):
self.kf1 = kalmanFilter(disc... | en | 0.921635 | # the prior on the mean is zero, but observe 1, with # discount = 1, one should expect the filterd mean to be 0.5 # the prior on the mean is zero, but observe 1, with discount = 0 # one should expect the filtered mean close to 1 # with mean being 0 and observe 1 and 0 consectively, one shall # expect the smoothed mean ... | 2.6985 | 3 |
change_threshold_migration.py | arcapix/gpfsapi-examples | 10 | 2280 | from arcapix.fs.gpfs.policy import PlacementPolicy
from arcapix.fs.gpfs.rule import MigrateRule
# load placement policy for mmfs1
policy = PlacementPolicy('mmfs1')
# create a new migrate rule for 'sata1'
r = MigrateRule(source='sata1', threshold=(90, 50))
# add rule to start of the policy
policy.rules.insert(r, 0)
... | from arcapix.fs.gpfs.policy import PlacementPolicy
from arcapix.fs.gpfs.rule import MigrateRule
# load placement policy for mmfs1
policy = PlacementPolicy('mmfs1')
# create a new migrate rule for 'sata1'
r = MigrateRule(source='sata1', threshold=(90, 50))
# add rule to start of the policy
policy.rules.insert(r, 0)
... | en | 0.709783 | # load placement policy for mmfs1 # create a new migrate rule for 'sata1' # add rule to start of the policy # save changes | 1.477506 | 1 |
1/puzzle1.py | tjol/advent-of-code-2021 | 1 | 2281 | <reponame>tjol/advent-of-code-2021<gh_stars>1-10
#!/usr/bin/env python3
import sys
depths = list(map(int, sys.stdin))
increased = [a > b for (a, b) in zip(depths[1:], depths[:-1])]
print(sum(increased))
| #!/usr/bin/env python3
import sys
depths = list(map(int, sys.stdin))
increased = [a > b for (a, b) in zip(depths[1:], depths[:-1])]
print(sum(increased)) | fr | 0.221828 | #!/usr/bin/env python3 | 3.186251 | 3 |
project/app/paste/controllers.py | An0nYm0u5101/Pastebin | 1 | 2282 | from flask import Blueprint, request, render_template, \
flash, g, session, redirect, url_for, jsonify
from app import db, requires_auth
from flask_cors import CORS
from .models import Paste
import uuid
from datetime import datetime
from app.user.models import User
from pygments import highlight
from pygments.lexers i... | from flask import Blueprint, request, render_template, \
flash, g, session, redirect, url_for, jsonify
from app import db, requires_auth
from flask_cors import CORS
from .models import Paste
import uuid
from datetime import datetime
from app.user.models import User
from pygments import highlight
from pygments.lexers i... | en | 0.134753 | # jsonify(success=True, paste=paste.to_dict()) # user_id = session['user_id'] # pastes = paste.query.filter(paste.user_id == user_id).all() # return jsonify(success=True, pastes=[paste.to_dict() for paste in # pastes]) # @mod_paste.route('/<url>/embed', methods=['POST']) # def embed_code(url): # paste = Paste.query.fi... | 2.190291 | 2 |
control_drone/run_model_on_cam.py | Apiquet/DeepLearningFrameworkFromScratch | 1 | 2283 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script run neural network model on a camera live stream
"""
import argparse
import cv2
import numpy as np
import os
import time
import sys
COMMANDS = {0: "move_forward", 1: "go_down", 2: "rot_10_deg",
3: "go_up", 4: "take_off", 5: "land", 6: "idle"}... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script run neural network model on a camera live stream
"""
import argparse
import cv2
import numpy as np
import os
import time
import sys
COMMANDS = {0: "move_forward", 1: "go_down", 2: "rot_10_deg",
3: "go_up", 4: "take_off", 5: "land", 6: "idle"}... | en | 0.781235 | #!/usr/bin/env python # -*- coding: utf-8 -*- This script run neural network model on a camera live stream Function to send commands to an Anafi drone in function of the command id Drone connection Load model Webcam process # ESC pressed # p pressed | 2.774104 | 3 |
classify_images.py | rmsare/cs231a-project | 2 | 2284 | <filename>classify_images.py<gh_stars>1-10
"""
Classification of pixels in images using color and other features.
General pipeline usage:
1. Load and segment images (img_utils.py)
2. Prepare training data (label_image.py)
3. Train classifier or cluster data (sklearn KMeans, MeanShift, SVC, etc.)
4. Predict labels on ... | <filename>classify_images.py<gh_stars>1-10
"""
Classification of pixels in images using color and other features.
General pipeline usage:
1. Load and segment images (img_utils.py)
2. Prepare training data (label_image.py)
3. Train classifier or cluster data (sklearn KMeans, MeanShift, SVC, etc.)
4. Predict labels on ... | en | 0.723103 | Classification of pixels in images using color and other features. General pipeline usage: 1. Load and segment images (img_utils.py) 2. Prepare training data (label_image.py) 3. Train classifier or cluster data (sklearn KMeans, MeanShift, SVC, etc.) 4. Predict labels on new image or directory (classify_directory()) 5... | 3.393081 | 3 |
quick_start/my_text_classifier/predictors/sentence_classifier_predictor.py | ramild/allennlp-guide | 71 | 2285 | from allennlp.common import JsonDict
from allennlp.data import DatasetReader, Instance
from allennlp.models import Model
from allennlp.predictors import Predictor
from overrides import overrides
@Predictor.register("sentence_classifier")
class SentenceClassifierPredictor(Predictor):
def predict(self, sentence: st... | from allennlp.common import JsonDict
from allennlp.data import DatasetReader, Instance
from allennlp.models import Model
from allennlp.predictors import Predictor
from overrides import overrides
@Predictor.register("sentence_classifier")
class SentenceClassifierPredictor(Predictor):
def predict(self, sentence: st... | none | 1 | 2.450617 | 2 | |
ciphers/SKINNY-TK2/SKINNY-TK2/skinnytk2.py | j-danner/autoguess | 7 | 2286 | # Created on Sep 7, 2020
# author: <NAME>
# contact: <EMAIL>
import os
output_dir = os.path.curdir
def skinnytk2(R=1):
"""
This function generates the relations of Skinny-n-n for R rounds.
tk ================================================> TWEAKEY_P(tk) ===> ---
SB ... | # Created on Sep 7, 2020
# author: <NAME>
# contact: <EMAIL>
import os
output_dir = os.path.curdir
def skinnytk2(R=1):
"""
This function generates the relations of Skinny-n-n for R rounds.
tk ================================================> TWEAKEY_P(tk) ===> ---
SB ... | en | 0.754237 | # Created on Sep 7, 2020 # author: <NAME> # contact: <EMAIL> This function generates the relations of Skinny-n-n for R rounds. tk ================================================> TWEAKEY_P(tk) ===> --- SB AC | P MC SB AC ... | 2.844935 | 3 |
tests/test_bmipy.py | visr/bmi-python | 14 | 2287 | <filename>tests/test_bmipy.py<gh_stars>10-100
import pytest
from bmipy import Bmi
class EmptyBmi(Bmi):
def __init__(self):
pass
def initialize(self, config_file):
pass
def update(self):
pass
def update_until(self, then):
pass
def finalize(self):
pass
... | <filename>tests/test_bmipy.py<gh_stars>10-100
import pytest
from bmipy import Bmi
class EmptyBmi(Bmi):
def __init__(self):
pass
def initialize(self, config_file):
pass
def update(self):
pass
def update_until(self, then):
pass
def finalize(self):
pass
... | none | 1 | 2.056297 | 2 | |
scrapy_compose/fields/parser/string_field.py | Sphynx-HenryAY/scrapy-compose | 0 | 2288 | <reponame>Sphynx-HenryAY/scrapy-compose
from scrapy_compose.utils.context import realize
from .field import FuncField as BaseField
class StringField( BaseField ):
process_timing = [ "post_pack" ]
def __init__( self, key = None, value = None, selector = None, **kwargs ):
#unify value format
if isinstance( valu... | from scrapy_compose.utils.context import realize
from .field import FuncField as BaseField
class StringField( BaseField ):
process_timing = [ "post_pack" ]
def __init__( self, key = None, value = None, selector = None, **kwargs ):
#unify value format
if isinstance( value, str ):
value = { "_type": "string",... | en | 0.086953 | #unify value format | 2.21543 | 2 |
app/request.py | vincentmuya/News-highlight | 0 | 2289 | import urllib.request
import json
from .models import News
# Getting api key
api_key = None
# Getting the movie base url
base_url = None
def configure_request(app):
global api_key,base_url
api_key = app.config['NEWS_API_KEY']
base_url = app.config['NEWS_API_BASE_URL']
def get_news_source(country,category)... | import urllib.request
import json
from .models import News
# Getting api key
api_key = None
# Getting the movie base url
base_url = None
def configure_request(app):
global api_key,base_url
api_key = app.config['NEWS_API_KEY']
base_url = app.config['NEWS_API_BASE_URL']
def get_news_source(country,category)... | en | 0.838077 | # Getting api key # Getting the movie base url Function that gets the json response to our url request this function processes the results and converts them into a list the source list is a list of dictionaries containing news results | 3.044588 | 3 |
hypernet/src/thermophysicalModels/reactionThermo/mixture/multiComponent.py | christian-jacobsen/hypernet | 0 | 2290 | import numpy as np
from hypernet.src.general import const
from hypernet.src.general import utils
from hypernet.src.thermophysicalModels.reactionThermo.mixture import Basic
class MultiComponent(Basic):
# Initialization
###########################################################################
def __init... | import numpy as np
from hypernet.src.general import const
from hypernet.src.general import utils
from hypernet.src.thermophysicalModels.reactionThermo.mixture import Basic
class MultiComponent(Basic):
# Initialization
###########################################################################
def __init... | en | 0.299258 | # Initialization ########################################################################### # Methods ########################################################################### # Mixture properties ------------------------------------------------------ # Update mass/molar fractions # Update mixture/species properties... | 2.306342 | 2 |
Exercises/W08D04_Exercise_01_Django_Cat_Collector/main_app/models.py | Roger-Takeshita/Software_Engineer | 2 | 2291 | <filename>Exercises/W08D04_Exercise_01_Django_Cat_Collector/main_app/models.py
from django.db import models
from django.urls import reverse
from datetime import date
from django.contrib.auth.models import User #! 1 - Import user models
MEALS = (
('B', 'Breakfast'),
('L', 'Lunch'),
('D... | <filename>Exercises/W08D04_Exercise_01_Django_Cat_Collector/main_app/models.py
from django.db import models
from django.urls import reverse
from datetime import date
from django.contrib.auth.models import User #! 1 - Import user models
MEALS = (
('B', 'Breakfast'),
('L', 'Lunch'),
('D... | en | 0.841745 | #! 1 - Import user models #+ 1.1 - Add user as ForeignKey (URL mapping, we use this to point to our class based views) # Nice method for obtaining the friendly value of a Field.choice # change the default sort | 2.724072 | 3 |
kedro-airflow/kedro_airflow/__init__.py | kedro-org/kedro-plugins | 6 | 2292 | <gh_stars>1-10
""" Kedro plugin for running a project with Airflow """
__version__ = "0.5.0"
| """ Kedro plugin for running a project with Airflow """
__version__ = "0.5.0" | en | 0.896125 | Kedro plugin for running a project with Airflow | 1.032515 | 1 |
soccer/gameplay/plays/testing/debug_window_evaluator.py | AniruddhaG123/robocup-software | 1 | 2293 | <reponame>AniruddhaG123/robocup-software
import play
import behavior
import main
import robocup
import constants
import time
import math
## This isn't a real play, but it's pretty useful
# Turn it on and we'll draw the window evaluator stuff on-screen from the ball to our goal
class DebugWindowEvaluator(play.Play):
... | import play
import behavior
import main
import robocup
import constants
import time
import math
## This isn't a real play, but it's pretty useful
# Turn it on and we'll draw the window evaluator stuff on-screen from the ball to our goal
class DebugWindowEvaluator(play.Play):
def __init__(self):
super().__... | en | 0.967399 | ## This isn't a real play, but it's pretty useful # Turn it on and we'll draw the window evaluator stuff on-screen from the ball to our goal | 3.380763 | 3 |
rainbowconnection/sources/phoenix/utils.py | zkbt/rainbow-connection | 6 | 2294 | from ...imports import *
def stringify_metallicity(Z):
"""
Convert a metallicity into a PHOENIX-style string.
Parameters
----------
Z : float
[Fe/H]-style metallicity (= 0.0 for solar)
"""
if Z <= 0:
return "-{:03.1f}".format(np.abs(Z))
else:
return "+{:03.1f}"... | from ...imports import *
def stringify_metallicity(Z):
"""
Convert a metallicity into a PHOENIX-style string.
Parameters
----------
Z : float
[Fe/H]-style metallicity (= 0.0 for solar)
"""
if Z <= 0:
return "-{:03.1f}".format(np.abs(Z))
else:
return "+{:03.1f}"... | en | 0.500841 | Convert a metallicity into a PHOENIX-style string. Parameters ---------- Z : float [Fe/H]-style metallicity (= 0.0 for solar) | 2.801408 | 3 |
shipane_sdk/transaction.py | awfssv/ShiPanE-Python-SDK | 1 | 2295 | # -*- coding: utf-8 -*-
class Transaction(object):
def __init__(self, **kwargs):
self._completed_at = kwargs.get('completed_at')
self._type = kwargs.get('type')
self._symbol = kwargs.get('symbol')
self._price = kwargs.get('price')
self._amount = kwargs.get('amount')
de... | # -*- coding: utf-8 -*-
class Transaction(object):
def __init__(self, **kwargs):
self._completed_at = kwargs.get('completed_at')
self._type = kwargs.get('type')
self._symbol = kwargs.get('symbol')
self._price = kwargs.get('price')
self._amount = kwargs.get('amount')
de... | en | 0.769321 | # -*- coding: utf-8 -*- | 2.884403 | 3 |
tensorflow_probability/python/distributions/laplace_test.py | wataruhashimoto52/probability | 1 | 2296 | <reponame>wataruhashimoto52/probability
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | en | 0.759331 | # Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o... | 1.883831 | 2 |
app/__init__.py | credwood/bitplayers | 1 | 2297 | <reponame>credwood/bitplayers<filename>app/__init__.py
import dash
from flask import Flask
from flask.helpers import get_root_path
from flask_login import login_required
from flask_wtf.csrf import CSRFProtect
from flask_admin import Admin, BaseView, expose
from flask_admin.contrib.sqla import ModelView
from datetime im... | import dash
from flask import Flask
from flask.helpers import get_root_path
from flask_login import login_required
from flask_wtf.csrf import CSRFProtect
from flask_admin import Admin, BaseView, expose
from flask_admin.contrib.sqla import ModelView
from datetime import datetime
from dateutil import parser
import pytz
f... | en | 0.640134 | #from app.dashapp2.layout import layout as layout_2 #from app.dashapp2.callbacks import register_callbacks as register_callbacks_2 #register_dashapp(server, 'dashapp2', 'dashboard2', layout_2, register_callbacks_2) #date = parser.parse(str(date)) #native = date.astimezone(western) # Meta tags for viewport responsivenes... | 1.915957 | 2 |
selectinf/randomized/approx_reference_grouplasso.py | kevinbfry/selective-inference | 14 | 2298 | from __future__ import print_function
from scipy.linalg import block_diag
from scipy.stats import norm as ndist
from scipy.interpolate import interp1d
import collections
import numpy as np
from numpy import log
from numpy.linalg import norm, qr, inv, eig
import pandas as pd
import regreg.api as rr
from .randomization... | from __future__ import print_function
from scipy.linalg import block_diag
from scipy.stats import norm as ndist
from scipy.interpolate import interp1d
import collections
import numpy as np
from numpy import log
from numpy.linalg import norm, qr, inv, eig
import pandas as pd
import regreg.api as rr
from .randomization... | en | 0.792542 | # should lasso solver be used where applicable - defaults to True # make sure groups looks sensible # log likelihood : quadratic loss # ridge parameter # group lasso penalty (from regreg) # use regular lasso penalty if all groups are size 1 # need to provide weights an an np.array rather than a dictionary # store group... | 2.094085 | 2 |
internals/states.py | mattjj/pyhsmm-collapsedinfinite | 0 | 2299 | <reponame>mattjj/pyhsmm-collapsedinfinite
from __future__ import division
import numpy as np
na = np.newaxis
import collections, itertools
import abc
from pyhsmm.util.stats import sample_discrete, sample_discrete_from_log, combinedata
from pyhsmm.util.general import rle as rle
# NOTE: assumes censoring. can make no c... | from __future__ import division
import numpy as np
na = np.newaxis
import collections, itertools
import abc
from pyhsmm.util.stats import sample_discrete, sample_discrete_from_log, combinedata
from pyhsmm.util.general import rle as rle
# NOTE: assumes censoring. can make no censoring by adding to score of last
# segm... | en | 0.859008 | # NOTE: assumes censoring. can make no censoring by adding to score of last # segment # special constant for indicating a state or state range that is being resampled # special constant indicating a potentially new label # state labels are sampled uniformly from 0 to abignumber exclusive #################### # States ... | 2.137907 | 2 |