hexsha stringlengths 40 40 | size int64 3 1.03M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 972 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 972 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 972 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 3 1.03M | avg_line_length float64 1.13 941k | max_line_length int64 2 941k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c1667eccd6f32cd7ccfd94c268837b5cda92f3bc | 2,598 | py | Python | Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalMinBiasAAG_cff.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 6 | 2017-09-08T14:12:56.000Z | 2022-03-09T23:57:01.000Z | Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalMinBiasAAG_cff.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 545 | 2017-09-19T17:10:19.000Z | 2022-03-07T16:55:27.000Z | Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalMinBiasAAG_cff.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 14 | 2017-10-04T09:47:21.000Z | 2019-10-23T18:04:45.000Z | import FWCore.ParameterSet.Config as cms
# Set the HLT paths
import HLTrigger.HLTfilters.hltHighLevel_cfi
ALCARECOSiStripCalMinBiasAAGHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
andOr = True, ## choose logical OR between Triggerbits
## HLTPaths = [
## #Minimum Bias
## "HLT_MinBias*"... | 50.941176 | 122 | 0.765589 |
40cdcd1898605a4abeff81b1aa7828f19641802a | 5,596 | py | Python | contentcuration/contentcuration/tests/test_channelcache.py | nucleogenesis/studio | 4b892bf140fd93ceec869f2422b460fe2770bba5 | [
"MIT"
] | null | null | null | contentcuration/contentcuration/tests/test_channelcache.py | nucleogenesis/studio | 4b892bf140fd93ceec869f2422b460fe2770bba5 | [
"MIT"
] | 4 | 2016-05-06T17:19:30.000Z | 2019-03-15T01:51:24.000Z | contentcuration/contentcuration/tests/test_channelcache.py | nucleogenesis/studio | 4b892bf140fd93ceec869f2422b460fe2770bba5 | [
"MIT"
] | 4 | 2016-10-18T22:49:08.000Z | 2019-09-17T11:20:51.000Z | #!/usr/bin/env python
#
# These are tests for the ChannelCache class.
#
from .base import StudioTestCase
from .testdata import channel
from .testdata import node
from contentcuration.utils.channelcache import ChannelCacher
class ChannelCacherTestCase(StudioTestCase):
NUM_INITIAL_PUBLIC_CHANNELS = 2
def setU... | 33.508982 | 88 | 0.658327 |
a94307161d43171bddb64e92bbaf491ea0989b0f | 2,742 | py | Python | python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_c_setup.py | Shaun2016/Paddle | b963903806c8a6694df79b42aaab6578a0ef6afb | [
"Apache-2.0"
] | null | null | null | python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_c_setup.py | Shaun2016/Paddle | b963903806c8a6694df79b42aaab6578a0ef6afb | [
"Apache-2.0"
] | null | null | null | python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_c_setup.py | Shaun2016/Paddle | b963903806c8a6694df79b42aaab6578a0ef6afb | [
"Apache-2.0"
] | 1 | 2021-12-09T08:59:17.000Z | 2021-12-09T08:59:17.000Z | # Copyright (c) 2022 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... | 33.439024 | 79 | 0.735959 |
875dfd3c233c3f3839e491d2e6a1e0baee5f40b2 | 22,350 | py | Python | pyflaski/pyflaski/idendrogram.py | mpg-age-bioinformatics/flaski | f56e00dd80d8706ecb8593ba6585a97eed881896 | [
"MIT"
] | 9 | 2020-08-03T01:22:59.000Z | 2022-03-03T02:02:04.000Z | pyflaski/pyflaski/idendrogram.py | mpg-age-bioinformatics/flaski | f56e00dd80d8706ecb8593ba6585a97eed881896 | [
"MIT"
] | 79 | 2020-06-03T06:34:46.000Z | 2021-09-22T13:31:43.000Z | pyflaski/pyflaski/idendrogram.py | mpg-age-bioinformatics/flaski | f56e00dd80d8706ecb8593ba6585a97eed881896 | [
"MIT"
] | 5 | 2020-10-05T10:20:23.000Z | 2022-03-01T14:23:12.000Z | #from matplotlib.figure import Figure
import plotly.express as px
import plotly.graph_objects as go
import plotly.figure_factory as ff
from scipy.spatial.distance import pdist
import scipy.cluster.hierarchy as sch
from collections import OrderedDict
import numpy as np
import sys
def GET_COLOR(x):
if str(x)[:3].low... | 47.251586 | 202 | 0.63736 |
30eb50111fa27898698159ac8e2dd677e77d1f94 | 15,490 | py | Python | WebServer.py | seriousthoj/PlexConnect | 9c726f8cae8d13479df51ae8e89900ef30756c63 | [
"MIT"
] | null | null | null | WebServer.py | seriousthoj/PlexConnect | 9c726f8cae8d13479df51ae8e89900ef30756c63 | [
"MIT"
] | null | null | null | WebServer.py | seriousthoj/PlexConnect | 9c726f8cae8d13479df51ae8e89900ef30756c63 | [
"MIT"
] | 1 | 2019-01-30T21:19:11.000Z | 2019-01-30T21:19:11.000Z | #!/usr/bin/env python
"""
Sources:
http://fragments.turtlemeat.com/pythonwebserver.php
http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python
...stackoverflow.com and such
after 27Aug - Apple's switch to https:
- added https WebServer with SSL encryption - needs valid (private) vertificate on a... | 38.725 | 118 | 0.538347 |
d46d53d79d2704b2e2cecbd546e3bb19755eb9b0 | 305 | py | Python | home/templatetags/custom_tags.py | mritunjayagarwal/school-management-system | 1cb42345ac793d80d4a676c47f0a85c197b889ae | [
"MIT"
] | null | null | null | home/templatetags/custom_tags.py | mritunjayagarwal/school-management-system | 1cb42345ac793d80d4a676c47f0a85c197b889ae | [
"MIT"
] | null | null | null | home/templatetags/custom_tags.py | mritunjayagarwal/school-management-system | 1cb42345ac793d80d4a676c47f0a85c197b889ae | [
"MIT"
] | null | null | null | from django import template
register = template.Library()
@register.filter(name = 'split')
def split(value, arg):
return value.split(arg)
@register.filter(name = 'to_list')
def to_list(value):
return list(value)
@register.filter(name = 'int_to_str')
def int_to_str(value):
return str(value) | 21.785714 | 37 | 0.721311 |
aae1c1c9e45be41c209a4268e587bc7d6673656f | 775 | py | Python | simulations/utils/cost.py | danibachar/Kube-Load-Balancing | 8b9ea68ddbb46cc730a02ffe30cc68b3d65ca491 | [
"MIT"
] | null | null | null | simulations/utils/cost.py | danibachar/Kube-Load-Balancing | 8b9ea68ddbb46cc730a02ffe30cc68b3d65ca491 | [
"MIT"
] | null | null | null | simulations/utils/cost.py | danibachar/Kube-Load-Balancing | 8b9ea68ddbb46cc730a02ffe30cc68b3d65ca491 | [
"MIT"
] | null | null | null | import pandas as pd
# Each criteria get equal weight for now
def simple_min_addative_weight(
price,
min_price,
price_weight,
latency,
min_latency,
latency_weight
):
price_part = 0
if price > 0:
price_part = (min_price/price)*price_weight
latency_part = 0
if latency > 0:... | 19.871795 | 59 | 0.665806 |
7d8201f013c8bcf6d7dc5ebe1a20c2de1d269fdf | 24,059 | py | Python | Oscillations.py | zleizzo/gradual | 3e48769c4e30a7f1577b360e3100335d08e40752 | [
"MIT"
] | null | null | null | Oscillations.py | zleizzo/gradual | 3e48769c4e30a7f1577b360e3100335d08e40752 | [
"MIT"
] | null | null | null | Oscillations.py | zleizzo/gradual | 3e48769c4e30a7f1577b360e3100335d08e40752 | [
"MIT"
] | null | null | null | import torch
import copy
import os
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_spd_matrix
from collections import deque
from scipy.stats import sem
from tqdm import tqdm
import matplotlib as mpl
linewidth = 3.
mpl.rcParams['lines.linewidth'] = linewidth
import warnings
warnin... | 40.640203 | 139 | 0.510744 |
ffe46067db10706dbc78a7cb11eafb3aecd868cc | 1,534 | py | Python | testbuilder/core/management/load_engine.py | AsafSilman/testbuilder | 931dd09483f86346575f22031413f47d2b22aa8e | [
"Apache-2.0"
] | 2 | 2018-08-05T18:26:11.000Z | 2018-08-08T10:05:36.000Z | testbuilder/core/management/load_engine.py | AsafSilman/testbuilder | 931dd09483f86346575f22031413f47d2b22aa8e | [
"Apache-2.0"
] | 14 | 2018-08-03T07:03:20.000Z | 2018-08-10T09:54:21.000Z | testbuilder/core/management/load_engine.py | AsafSilman/testbuilder | 931dd09483f86346575f22031413f47d2b22aa8e | [
"Apache-2.0"
] | null | null | null | """Loads instance of TBBaseEngine"""
from testbuilder.conf import settings
from testbuilder.core.engine import TBEngine
def load_engine():
"""
Create a TBEngine instance, load all settings from testbuilder settings
Returns:
TBEngine -- The loaded engine instance
"""
engine=TBEngine()
... | 34.088889 | 91 | 0.744459 |
17b27040a233b04dd637e53daaa3a92472d1e94e | 10,526 | py | Python | python_cowbull_game/v2_deprecated/GameController.py | dsandersAzure/python_cowbull_game | 82a0d8ee127869123d4fad51a8cd1707879e368f | [
"Apache-2.0"
] | 1 | 2017-05-01T20:13:40.000Z | 2017-05-01T20:13:40.000Z | python_cowbull_game/v2_deprecated/GameController.py | dsandersAzure/python_cowbull_game | 82a0d8ee127869123d4fad51a8cd1707879e368f | [
"Apache-2.0"
] | null | null | null | python_cowbull_game/v2_deprecated/GameController.py | dsandersAzure/python_cowbull_game | 82a0d8ee127869123d4fad51a8cd1707879e368f | [
"Apache-2.0"
] | null | null | null | import json
import logging
from python_cowbull_game.GameObject import GameObject
from python_digits import DigitWord
from python_cowbull_game.v2_deprecated.GameMode import GameMode
class GameController(object):
schema = {
"type": "object",
"properties":
{
"key": {"typ... | 34.854305 | 103 | 0.569352 |
66c818238bb587a61a34f1d4a23d7b201e980dcc | 1,018 | py | Python | checkov/kubernetes/checks/resource/k8s/KubeletAnonymousAuth.py | vangundy-jason-pfg/checkov | 2fb50908f62390c98dda665f1fa94fe24806b654 | [
"Apache-2.0"
] | null | null | null | checkov/kubernetes/checks/resource/k8s/KubeletAnonymousAuth.py | vangundy-jason-pfg/checkov | 2fb50908f62390c98dda665f1fa94fe24806b654 | [
"Apache-2.0"
] | null | null | null | checkov/kubernetes/checks/resource/k8s/KubeletAnonymousAuth.py | vangundy-jason-pfg/checkov | 2fb50908f62390c98dda665f1fa94fe24806b654 | [
"Apache-2.0"
] | null | null | null | from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.kubernetes.checks.resource.base_spec_check import BaseK8Check
class KubeletAnonymousAuth(BaseK8Check):
def __init__(self):
# CIS-1.6 4.2.1
id = "CKV_K8S_138"
name = "Ensure that the --anonymous-auth argument ... | 37.703704 | 113 | 0.660118 |
f0c75f29d46a1d9e99ff79e496780dae59d4d9be | 608 | py | Python | factory-method/python/DictionaryFactoryMethod.py | koonchen/awesome-design-patterns | 53891e5331b211bce7c2b3f8ea6fdd1a9f4086d1 | [
"MIT"
] | 5 | 2018-10-19T15:30:00.000Z | 2018-11-30T06:02:12.000Z | factory-method/python/DictionaryFactoryMethod.py | koonchen/awesome-design-patterns | 53891e5331b211bce7c2b3f8ea6fdd1a9f4086d1 | [
"MIT"
] | null | null | null | factory-method/python/DictionaryFactoryMethod.py | koonchen/awesome-design-patterns | 53891e5331b211bce7c2b3f8ea6fdd1a9f4086d1 | [
"MIT"
] | 2 | 2018-10-19T15:30:08.000Z | 2019-02-20T15:28:38.000Z | #!/usr/bin/env python
# coding:utf8
class ChineseGetter(object):
def __init__(self):
self.trans = dict(dog="狗", cat="猫")
def get(self, item):
return self.trans.get(item, str(item))
class EnglishGetter(object):
def get(self, item):
return str(item)
def get_localizer(language="E... | 22.518519 | 66 | 0.654605 |
9cd43654f9e8c7d8513293e21ce0daccc7240295 | 8,308 | py | Python | kubernetes_asyncio/client/models/v2beta1_metric_status.py | olitheolix/kubernetes_asyncio | 344426793e4e4b653bcd8e4a29c6fa4766e1fff7 | [
"Apache-2.0"
] | 1 | 2020-03-25T01:24:27.000Z | 2020-03-25T01:24:27.000Z | kubernetes_asyncio/client/models/v2beta1_metric_status.py | olitheolix/kubernetes_asyncio | 344426793e4e4b653bcd8e4a29c6fa4766e1fff7 | [
"Apache-2.0"
] | null | null | null | kubernetes_asyncio/client/models/v2beta1_metric_status.py | olitheolix/kubernetes_asyncio | 344426793e4e4b653bcd8e4a29c6fa4766e1fff7 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... | 36.279476 | 350 | 0.633245 |
aed5c55aa5c5bd81fa5c98126f5c976b6799fea9 | 2,950 | py | Python | tests/test_extra_verifications.py | jekel/sanic-jwt | 4f6ab07376ad90011d40e205feacae8219359d6f | [
"MIT"
] | 226 | 2017-09-05T08:23:58.000Z | 2022-03-28T09:23:47.000Z | tests/test_extra_verifications.py | jekel/sanic-jwt | 4f6ab07376ad90011d40e205feacae8219359d6f | [
"MIT"
] | 179 | 2017-09-27T08:33:16.000Z | 2022-01-28T20:35:23.000Z | tests/test_extra_verifications.py | jekel/sanic-jwt | 4f6ab07376ad90011d40e205feacae8219359d6f | [
"MIT"
] | 45 | 2017-10-14T10:26:46.000Z | 2022-02-04T15:01:20.000Z | from sanic import Sanic
from sanic.response import json
from sanic_jwt import Initialize, protected
def test_extra_verification_passing(app_with_extra_verification):
sanic_app, sanic_jwt = app_with_extra_verification
_, response = sanic_app.test_client.post(
"/auth", json={"username": "user1", "passw... | 27.314815 | 72 | 0.656949 |
f7ae2650f53a2d646cf7d166dc5546419f8d3b22 | 16,557 | py | Python | References/Geovana Neves/TCC_Geovana_Neves_GitHub/Turboprop/_baseline/Optimize.py | Vinicius-Tanigawa/Undergraduate-Research-Project | e92372f07882484b127d7affe305eeec2238b8a9 | [
"MIT"
] | null | null | null | References/Geovana Neves/TCC_Geovana_Neves_GitHub/Turboprop/_baseline/Optimize.py | Vinicius-Tanigawa/Undergraduate-Research-Project | e92372f07882484b127d7affe305eeec2238b8a9 | [
"MIT"
] | null | null | null | References/Geovana Neves/TCC_Geovana_Neves_GitHub/Turboprop/_baseline/Optimize.py | Vinicius-Tanigawa/Undergraduate-Research-Project | e92372f07882484b127d7affe305eeec2238b8a9 | [
"MIT"
] | null | null | null | # Optimize.py
# Created: Feb 2016, M. Vegh
# Modified: Aug 2017, E. Botero
# Aug 2018, T. MacDonald
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
import SUAVE
from SUAVE.Core import U... | 46.119777 | 138 | 0.497614 |
d49bbdd9b59fc7fc5f7c61bb7c10993ec6f65a69 | 862 | py | Python | Python/leetcode/Maximum Length of Pair Chain/solution.py | pterodragon/programming | 1e9c10490c3aaebe51bc06f8e0c6566e9f8b461c | [
"MIT"
] | 2 | 2018-10-06T14:43:13.000Z | 2019-02-03T13:07:14.000Z | Python/leetcode/Maximum Length of Pair Chain/solution.py | pterodragon/programming | 1e9c10490c3aaebe51bc06f8e0c6566e9f8b461c | [
"MIT"
] | null | null | null | Python/leetcode/Maximum Length of Pair Chain/solution.py | pterodragon/programming | 1e9c10490c3aaebe51bc06f8e0c6566e9f8b461c | [
"MIT"
] | null | null | null | class Solution:
def findLongestChain(self, pairs):
"""
:type pairs: List[List[int]]
:rtype: int
"""
"""
sort pairs first
only choose the smallest pairs if they have the same first element
i.e. [1,2] and [1,10], delete the [1, 10]
dp[x] = long... | 26.9375 | 74 | 0.436195 |
f4b6b076e71902917a23c4cdb3e78ed0803dd053 | 2,978 | py | Python | app/api/users.py | cuongbm/microblog | 16b47b11b1f2b2877462c86873eb435beb10b545 | [
"MIT"
] | null | null | null | app/api/users.py | cuongbm/microblog | 16b47b11b1f2b2877462c86873eb435beb10b545 | [
"MIT"
] | null | null | null | app/api/users.py | cuongbm/microblog | 16b47b11b1f2b2877462c86873eb435beb10b545 | [
"MIT"
] | null | null | null | from flask import jsonify, request, url_for
from app import db
from app.api import bp
from app.api.auth import token_auth
from app.api.errors import bad_request
from app.api.pagination import PaginationAPI
from app.models import User
@bp.route('/users/<int:id>', methods=['GET'])
@token_auth.login_required
def get_us... | 35.879518 | 88 | 0.680658 |
bbfc9eb4069c568a732c65077cb5a8442cdb433e | 909 | py | Python | salt/modules/win_shadow.py | gotcha/salt | 7b84c704777d3d2062911895dc3fdf93d40e9848 | [
"Apache-2.0"
] | 2 | 2019-03-30T02:12:56.000Z | 2021-03-08T18:59:46.000Z | salt/modules/win_shadow.py | gotcha/salt | 7b84c704777d3d2062911895dc3fdf93d40e9848 | [
"Apache-2.0"
] | null | null | null | salt/modules/win_shadow.py | gotcha/salt | 7b84c704777d3d2062911895dc3fdf93d40e9848 | [
"Apache-2.0"
] | 1 | 2020-12-04T11:28:06.000Z | 2020-12-04T11:28:06.000Z | '''
Manage the shadow file
'''
import salt.utils
def __virtual__():
'''
Only works on Windows systems
'''
if salt.utils.is_windows():
return 'shadow'
return False
def info(name):
'''
Return information for the specified user
This is just returns dummy data so that salt state... | 18.18 | 65 | 0.517052 |
196c539a80470d230e17bc9645e1bb1c3150f1f2 | 2,299 | py | Python | samples/generated_samples/aiplatform_generated_aiplatform_v1_featurestore_service_batch_read_feature_values_async.py | lclc19/python-aiplatform | d8da2e365277441abadb04328943f23345d72b0e | [
"Apache-2.0"
] | 7 | 2021-02-21T10:39:41.000Z | 2021-12-07T07:31:28.000Z | samples/generated_samples/aiplatform_generated_aiplatform_v1_featurestore_service_batch_read_feature_values_async.py | lclc19/python-aiplatform | d8da2e365277441abadb04328943f23345d72b0e | [
"Apache-2.0"
] | 6 | 2021-02-02T23:46:11.000Z | 2021-11-15T01:46:02.000Z | samples/generated_samples/aiplatform_generated_aiplatform_v1_featurestore_service_batch_read_feature_values_async.py | lclc19/python-aiplatform | d8da2e365277441abadb04328943f23345d72b0e | [
"Apache-2.0"
] | 4 | 2021-01-28T23:25:45.000Z | 2021-08-30T01:55:16.000Z | # -*- coding: utf-8 -*-
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 36.492063 | 93 | 0.775555 |
597880ad121cc788cd55ef901b9fe28bf47a73b5 | 26,141 | py | Python | trac/db/api.py | davigo/tracsoftpi | 2a325bdee77903bd5ee2c13df28732bceaf37470 | [
"BSD-3-Clause"
] | null | null | null | trac/db/api.py | davigo/tracsoftpi | 2a325bdee77903bd5ee2c13df28732bceaf37470 | [
"BSD-3-Clause"
] | null | null | null | trac/db/api.py | davigo/tracsoftpi | 2a325bdee77903bd5ee2c13df28732bceaf37470 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2020 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac... | 35.325676 | 78 | 0.577101 |
69a4ea1d91d0b1fc4a1fffa32b24e51725dfe555 | 10,887 | py | Python | examples/widgets/forms/askusingform.py | offlineJ/idapython | 30c721083d580d81dd95ea8a3d79306f94c7ba3f | [
"BSD-3-Clause"
] | null | null | null | examples/widgets/forms/askusingform.py | offlineJ/idapython | 30c721083d580d81dd95ea8a3d79306f94c7ba3f | [
"BSD-3-Clause"
] | null | null | null | examples/widgets/forms/askusingform.py | offlineJ/idapython | 30c721083d580d81dd95ea8a3d79306f94c7ba3f | [
"BSD-3-Clause"
] | null | null | null | from __future__ import print_function
# -----------------------------------------------------------------------
# This is an example illustrating how to use the Form class
# (c) Hex-Rays
#
import ida_kernwin
# --------------------------------------------------------------------------
class busy_form_t(ida_kernwin.Form... | 33.601852 | 103 | 0.528704 |
730faabbb1abb6ea8e502046ced8db4f57d19f01 | 3,525 | py | Python | mars/learn/glm/tests/test_logistic.py | wjsi/mars | a69fb19edfe748d4393b90ff2c4941a76c084596 | [
"Apache-2.0"
] | 1 | 2022-02-02T03:03:48.000Z | 2022-02-02T03:03:48.000Z | mars/learn/glm/tests/test_logistic.py | wjsi/mars | a69fb19edfe748d4393b90ff2c4941a76c084596 | [
"Apache-2.0"
] | null | null | null | mars/learn/glm/tests/test_logistic.py | wjsi/mars | a69fb19edfe748d4393b90ff2c4941a76c084596 | [
"Apache-2.0"
] | null | null | null | # Copyright 1999-2021 Alibaba Group Holding 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 applicable law or a... | 30.652174 | 82 | 0.691348 |
d01663890ba31661007b2c6b26d6b88d9acc62cc | 4,592 | py | Python | PythonAPI/pycocotoolse/mask.py | linhandev/cocoapie | f26e17a1e1d91e04f0d1a2b55d11248147f634fa | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | PythonAPI/pycocotoolse/mask.py | linhandev/cocoapie | f26e17a1e1d91e04f0d1a2b55d11248147f634fa | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | PythonAPI/pycocotoolse/mask.py | linhandev/cocoapie | f26e17a1e1d91e04f0d1a2b55d11248147f634fa | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | __author__ = 'tsungyi'
import pycocotoolse._mask as _mask
# Interface for manipulating masks stored in RLE format.
#
# RLE is a simple yet efficient format for storing binary masks. RLE
# first divides a vector (or vectorized image) into a series of piecewise
# constant regions and then for each piece simply stores t... | 44.582524 | 100 | 0.690113 |
7db5cff998aadf7bc38969ae57c8c8dc633e5b72 | 2,303 | py | Python | examples/torch/trpo_pendulum_ray_sampler.py | bainro/garage | c5afbb19524792d9bbad9b9741f45e1d48ddca3d | [
"MIT"
] | null | null | null | examples/torch/trpo_pendulum_ray_sampler.py | bainro/garage | c5afbb19524792d9bbad9b9741f45e1d48ddca3d | [
"MIT"
] | null | null | null | examples/torch/trpo_pendulum_ray_sampler.py | bainro/garage | c5afbb19524792d9bbad9b9741f45e1d48ddca3d | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""This is an example to train a task with TRPO algorithm (PyTorch).
Uses Ray sampler instead of OnPolicyVectorizedSampler.
Here it runs InvertedDoublePendulum-v2 environment with 100 iterations.
"""
import numpy as np
import ray
import torch
from garage import wrap_experiment
from garage.exper... | 34.893939 | 77 | 0.651324 |
d20f142eb22c87e18e134e1f39a3e1cfc7f42fef | 5,672 | py | Python | tests/sentry/tasks/test_beacon.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | 4 | 2019-05-27T13:55:07.000Z | 2021-03-30T07:05:09.000Z | tests/sentry/tasks/test_beacon.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | 196 | 2019-06-10T08:34:10.000Z | 2022-02-22T01:26:13.000Z | tests/sentry/tasks/test_beacon.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | 1 | 2020-08-10T07:55:40.000Z | 2020-08-10T07:55:40.000Z | from __future__ import absolute_import, print_function
import json
import responses
import sentry
from mock import patch
from uuid import uuid4
from sentry import options
from sentry.models import Broadcast
from sentry.testutils import TestCase
from sentry.tasks.beacon import BEACON_URL, send_beacon
class SendBeac... | 32.976744 | 94 | 0.575282 |
62c3eca07defd025aeaca970e522c039d445fe05 | 1,699 | py | Python | test/functional/feature_abortnode.py | XziimP/bitcoinV | 38980aff8a8be63b338bbe83ea9896107104fc60 | [
"MIT"
] | 128 | 2015-01-20T22:21:27.000Z | 2021-09-17T04:40:56.000Z | test/functional/feature_abortnode.py | XSWLO/bitcoin | b931f61b9ab098ea4ea8fbe4cbf0b03c566c3f63 | [
"MIT"
] | 162 | 2015-02-23T00:45:54.000Z | 2021-11-10T09:51:47.000Z | test/functional/feature_abortnode.py | XSWLO/bitcoin | b931f61b9ab098ea4ea8fbe4cbf0b03c566c3f63 | [
"MIT"
] | 168 | 2015-01-13T13:54:38.000Z | 2022-01-24T23:04:06.000Z | #!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcoind aborts if can't disconnect a block.
- Start a single node and generate 3 blocks.
- Delete the... | 34.673469 | 77 | 0.689818 |
4546f9e19e527219b4a088509c1a8b00ae9278c4 | 1,425 | py | Python | pineboolib/qt3_widgets/qtextedit.py | deavid/pineboo | acc96ab6d5b8bb182990af6dea4bf0986af15549 | [
"MIT"
] | 2 | 2015-09-19T16:54:49.000Z | 2016-09-12T08:06:29.000Z | pineboolib/qt3_widgets/qtextedit.py | deavid/pineboo | acc96ab6d5b8bb182990af6dea4bf0986af15549 | [
"MIT"
] | 1 | 2017-08-14T17:07:14.000Z | 2017-08-15T00:22:47.000Z | pineboolib/qt3_widgets/qtextedit.py | deavid/pineboo | acc96ab6d5b8bb182990af6dea4bf0986af15549 | [
"MIT"
] | 9 | 2015-01-15T18:15:42.000Z | 2019-05-05T18:53:00.000Z | # -*- coding: utf-8 -*-
from PyQt5 import QtWidgets # type: ignore
from pineboolib.core import decorators
from typing import Any
class QTextEdit(QtWidgets.QTextEdit):
LogText = 0
RichText = 1
def __init__(self, parent=None) -> None:
super(QTextEdit, self).__init__(parent)
self.LogText = ... | 27.941176 | 87 | 0.625965 |
81c391bbd200800c2bc8385abcc9be999202b28d | 7,126 | py | Python | ugali/analysis/imf.py | mcnanna/ugali | 2572915b82af5b25e8762013e6d5baabdaa24b21 | [
"MIT"
] | null | null | null | ugali/analysis/imf.py | mcnanna/ugali | 2572915b82af5b25e8762013e6d5baabdaa24b21 | [
"MIT"
] | null | null | null | ugali/analysis/imf.py | mcnanna/ugali | 2572915b82af5b25e8762013e6d5baabdaa24b21 | [
"MIT"
] | 1 | 2019-07-18T16:42:27.000Z | 2019-07-18T16:42:27.000Z | """
Classes to handle initial mass functions (IMFs).
https://github.com/keflavich/imf
"""
from abc import abstractmethod
import numpy as np
import scipy.interpolate
from ugali.utils.logger import logger
############################################################
class IMF(object):
"""
Base class for initia... | 32.244344 | 102 | 0.550379 |
0a6e0859c7ea4d562e9809928c2a4726c91187fe | 8,900 | py | Python | cnn/train_search.py | yuezuegu/darts | 21af791837060b9e3372301c23cb94f74f56dbf1 | [
"Apache-2.0"
] | null | null | null | cnn/train_search.py | yuezuegu/darts | 21af791837060b9e3372301c23cb94f74f56dbf1 | [
"Apache-2.0"
] | null | null | null | cnn/train_search.py | yuezuegu/darts | 21af791837060b9e3372301c23cb94f74f56dbf1 | [
"Apache-2.0"
] | null | null | null | import os
import sys
import time
import glob
import numpy as np
import torch
import utils
import logging
import argparse
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
import torchvision.datasets as dset
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from model_searc... | 34.765625 | 141 | 0.735169 |
7daea682ad52aafe005d98e262a185b13641e860 | 14,792 | py | Python | dymos/transcriptions/common/control_group.py | cashmesh/dymos | 809f8e2cb2f82826a425286b9410b5c65df28949 | [
"Apache-2.0"
] | 1 | 2021-07-19T17:03:49.000Z | 2021-07-19T17:03:49.000Z | dymos/transcriptions/common/control_group.py | cashmesh/dymos | 809f8e2cb2f82826a425286b9410b5c65df28949 | [
"Apache-2.0"
] | null | null | null | dymos/transcriptions/common/control_group.py | cashmesh/dymos | 809f8e2cb2f82826a425286b9410b5c65df28949 | [
"Apache-2.0"
] | null | null | null | from collections.abc import Iterable
import numpy as np
import scipy.sparse as sp
import openmdao.api as om
from ..grid_data import GridData
from ...utils.misc import get_rate_units, CoerceDesvar, reshape_val
from ...utils.constants import INF_BOUND
from ...options import options as dymos_options
class ControlInte... | 41.318436 | 102 | 0.583423 |
afe690113b48cacd55d0b5f1e8f1492bae11b8c2 | 35 | py | Python | pygraylog/__init__.py | zmallen/pygraylog | cda2c6b583e8c7de47e98458b3faeae7d05a94d3 | [
"Apache-2.0"
] | 14 | 2016-08-29T16:31:14.000Z | 2021-11-30T10:39:29.000Z | pygraylog/__init__.py | zmallen/pygraylog | cda2c6b583e8c7de47e98458b3faeae7d05a94d3 | [
"Apache-2.0"
] | 9 | 2016-08-28T15:23:47.000Z | 2018-02-07T20:11:18.000Z | pygraylog/__init__.py | zmallen/pygraylog | cda2c6b583e8c7de47e98458b3faeae7d05a94d3 | [
"Apache-2.0"
] | 16 | 2016-10-04T17:37:42.000Z | 2021-07-08T15:43:50.000Z | import endpoints
import graylogapi
| 11.666667 | 17 | 0.885714 |
731de0a6d0aeeff06fe3f22999e564d574c63d39 | 109 | py | Python | srim/executor/__init__.py | agoose77/pysrim-executor | e251c6fc270ce8dfd500edd944c015d1911a20b9 | [
"MIT"
] | null | null | null | srim/executor/__init__.py | agoose77/pysrim-executor | e251c6fc270ce8dfd500edd944c015d1911a20b9 | [
"MIT"
] | null | null | null | srim/executor/__init__.py | agoose77/pysrim-executor | e251c6fc270ce8dfd500edd944c015d1911a20b9 | [
"MIT"
] | null | null | null | from .native import NativeExecutor
from .docker import DockerExecutor
from .executor import SRIMExecutorBase
| 27.25 | 38 | 0.862385 |
e857b4d8823b0a1e77d74fd02e69e06dae2091e2 | 1,470 | py | Python | offer/39_MoreThanHalfNumber.py | DevRoss/python-offer-code | 580b2d7b265b3fa8a598287f42a4ca8d9f834eb1 | [
"MIT"
] | 1 | 2019-09-02T07:14:26.000Z | 2019-09-02T07:14:26.000Z | offer/39_MoreThanHalfNumber.py | DevRoss/python-offer-code | 580b2d7b265b3fa8a598287f42a4ca8d9f834eb1 | [
"MIT"
] | 1 | 2019-09-02T07:14:48.000Z | 2019-10-21T14:30:37.000Z | offer/39_MoreThanHalfNumber.py | DevRoss/python-offer-code | 580b2d7b265b3fa8a598287f42a4ca8d9f834eb1 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by Ross on 19-1-19
def check(array: list, middle):
c = 0
for i in range(middle, len(array)):
if array[i] != array[middle]:
break
c += 1
for i in range(middle, -1, -1):
if array[i] != array[middle]:
break
... | 23.709677 | 69 | 0.493197 |
785180ec9a0b5d5ebefe4b3b654dc21c1a974f3e | 4,379 | py | Python | benchmark/startQiskit3155.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit3155.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit3155.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=4
# total number=47
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... | 35.314516 | 140 | 0.652432 |
04443d86cd7305f39a9edacf707b7f58cc42700e | 2,041 | py | Python | unittests/test_structures.py | argupta98/MotionPlanning | 1b8454ff2b6fe797773727d8de57999a9fc68c0f | [
"MIT"
] | null | null | null | unittests/test_structures.py | argupta98/MotionPlanning | 1b8454ff2b6fe797773727d8de57999a9fc68c0f | [
"MIT"
] | null | null | null | unittests/test_structures.py | argupta98/MotionPlanning | 1b8454ff2b6fe797773727d8de57999a9fc68c0f | [
"MIT"
] | null | null | null | from src.structures import *
import unittest
import numpy as np
class TestPolygonCounter(unittest.TestCase):
def test_specific_1(self):
vehicle= np.array([[-183.49516, -220.11375],
[-225.02881, -184.53629 ],
[-53.735645, -109.01296 ],
... | 39.25 | 85 | 0.476237 |
766102e3be6635ee2e02343a660e3148e3119aa0 | 854 | py | Python | LPPy/Abstract/tableau.py | VijayS02/LPPy | 7643e3cd78f4aac523611cfbfb2392d6e94d2a5c | [
"MIT"
] | null | null | null | LPPy/Abstract/tableau.py | VijayS02/LPPy | 7643e3cd78f4aac523611cfbfb2392d6e94d2a5c | [
"MIT"
] | null | null | null | LPPy/Abstract/tableau.py | VijayS02/LPPy | 7643e3cd78f4aac523611cfbfb2392d6e94d2a5c | [
"MIT"
] | null | null | null | import numpy as np
import LPPy.Abstract.lpp
from LPPy.Abstract.lpp import LPP
from LPPy.Abstract.outputHandler import OutputHandler
class Tableau(LPP):
"""
An abstract class representing a tableau form of an LPP used in the Simplex Method.
"""
# An output handler to send the output to.
outputter:... | 27.548387 | 116 | 0.663934 |
e93031e396da536f4b35390797447d0eb5e55a0c | 1,118 | py | Python | analysis/scripts/mx_select.py | sbooeshaghi/azucar | 0ced041aa9cfa52593109f79794ac6009adf909a | [
"BSD-2-Clause"
] | null | null | null | analysis/scripts/mx_select.py | sbooeshaghi/azucar | 0ced041aa9cfa52593109f79794ac6009adf909a | [
"BSD-2-Clause"
] | null | null | null | analysis/scripts/mx_select.py | sbooeshaghi/azucar | 0ced041aa9cfa52593109f79794ac6009adf909a | [
"BSD-2-Clause"
] | null | null | null | from collections import defaultdict
from .utils import read_markers, write_list
def read_genes(genes_fname, genes=defaultdict()):
with open(genes_fname) as f:
for idx, line in enumerate(f.readlines()):
gene = line.strip()
genes[gene] = idx
def sel_genes(genes, marker_genes, sel=[... | 31.942857 | 68 | 0.686047 |
06a56e4a40a041822e6879768a8022731d67db83 | 8,266 | py | Python | open_facebook/tests.py | devhub/Django-facebook | fec1b5dbd37f7840ee325f372ecf8754ce265c2a | [
"BSD-3-Clause"
] | null | null | null | open_facebook/tests.py | devhub/Django-facebook | fec1b5dbd37f7840ee325f372ecf8754ce265c2a | [
"BSD-3-Clause"
] | null | null | null | open_facebook/tests.py | devhub/Django-facebook | fec1b5dbd37f7840ee325f372ecf8754ce265c2a | [
"BSD-3-Clause"
] | null | null | null |
# -*- coding: utf-8 -*-
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'facebook_example.settings'
from open_facebook.api import *
import unittest
import logging
logger = logging.getLogger()
from open_facebook.utils import json
class TestErrorMapping(unittest.TestCase):
def test_oauth_errors(self):
... | 43.277487 | 457 | 0.650859 |
f7fa184eba534135c8de9fdf6f7eebf36d1427f5 | 4,647 | py | Python | 4-Informer/chainInformer/data/merge_2018_2020_data.py | wang-yuhao/On-the-topological-propertyof-dynamic-transaction-graph | 8dc8c3870befb82581099e3a6edc9f9734c23f31 | [
"MIT"
] | 1 | 2021-01-13T20:54:18.000Z | 2021-01-13T20:54:18.000Z | 4-Informer/chainInformer/data/merge_2018_2020_data.py | wang-yuhao/On-the-topological-propertyof-dynamic-transaction-graph | 8dc8c3870befb82581099e3a6edc9f9734c23f31 | [
"MIT"
] | null | null | null | 4-Informer/chainInformer/data/merge_2018_2020_data.py | wang-yuhao/On-the-topological-propertyof-dynamic-transaction-graph | 8dc8c3870befb82581099e3a6edc9f9734c23f31 | [
"MIT"
] | 1 | 2020-12-03T10:30:53.000Z | 2020-12-03T10:30:53.000Z | # Merge 2018-2020 data for Informer
# This process will generate merged base, betti, betti_deri, and fl files in PRICESSED_DIR.
import pandas as pd
import os
from sklearn.decomposition import PCA
import datetime
import math
import pandas as pd
import numpy as np
import torch
BETTI_NUMBER_DIR = "/content/drive/MyDriv... | 49.43617 | 135 | 0.688832 |
aaf2dcdc8b197e8b6ba98e8c986a198f99a36231 | 5,771 | py | Python | events/desucon2016/forms.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 13 | 2015-11-29T12:19:12.000Z | 2021-02-21T15:42:11.000Z | events/desucon2016/forms.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 23 | 2015-04-29T19:43:34.000Z | 2021-02-10T05:50:17.000Z | events/desucon2016/forms.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 11 | 2015-09-20T18:59:00.000Z | 2020-02-07T08:47:34.000Z |
from django import forms
from django.db.models import Q
from crispy_forms.layout import Layout, Fieldset
from core.utils import horizontal_form_helper, indented_without_label
from labour.forms import AlternativeFormMixin, SignupForm
from labour.models import Signup, JobCategory, WorkPeriod
from .models import Signu... | 28.014563 | 97 | 0.572344 |
0bfca8ae23b34363e45b1c60f0cad07e30487524 | 1,372 | py | Python | src/OTLMOW/OTLModel/Datatypes/KlWildreflectorDrager.py | davidvlaminck/OTLClassPython | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | 2 | 2022-02-01T08:58:11.000Z | 2022-02-08T13:35:17.000Z | src/OTLMOW/OTLModel/Datatypes/KlWildreflectorDrager.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | src/OTLMOW/OTLModel/Datatypes/KlWildreflectorDrager.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | # coding=utf-8
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
# Generated with OTLEnumerationCreator. To modify: extend, do not edit
class KlWildreflectorDrager(KeuzelijstField):
"""Mogelijke dragers van een wildreflect... | 54.88 | 141 | 0.641399 |
d538b82b5837a9e9c08e46c88f578613bd4e7b4c | 25,432 | py | Python | lib/streamlit/state/session_state.py | AnOctopus/streamlit | 6c5384f62c1415538347fa751185e5c487673f82 | [
"Apache-2.0"
] | 19,099 | 2019-08-25T14:00:15.000Z | 2022-03-31T21:00:28.000Z | lib/streamlit/state/session_state.py | AnOctopus/streamlit | 6c5384f62c1415538347fa751185e5c487673f82 | [
"Apache-2.0"
] | 3,078 | 2019-08-25T19:50:14.000Z | 2022-03-31T23:26:14.000Z | lib/streamlit/state/session_state.py | AnOctopus/streamlit | 6c5384f62c1415538347fa751185e5c487673f82 | [
"Apache-2.0"
] | 1,892 | 2019-08-26T04:44:24.000Z | 2022-03-30T16:11:51.000Z | # Copyright 2018-2021 Streamlit 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 in wr... | 35.619048 | 102 | 0.643953 |
f0dfd3feffa7b91535ff1745d77defee40f816de | 2,342 | py | Python | scrapy/contrib/downloadermiddleware/robotstxt.py | emschorsch/scrapy | acb7bad1ff4037b4a613ac94e2d3357bf92bdb8f | [
"BSD-3-Clause"
] | 1 | 2015-04-01T20:02:08.000Z | 2015-04-01T20:02:08.000Z | scrapy/contrib/downloadermiddleware/robotstxt.py | emschorsch/scrapy | acb7bad1ff4037b4a613ac94e2d3357bf92bdb8f | [
"BSD-3-Clause"
] | 2 | 2021-12-13T20:51:32.000Z | 2022-02-11T03:47:35.000Z | scrapy/contrib/downloadermiddleware/robotstxt.py | emschorsch/scrapy | acb7bad1ff4037b4a613ac94e2d3357bf92bdb8f | [
"BSD-3-Clause"
] | 1 | 2017-11-09T20:33:59.000Z | 2017-11-09T20:33:59.000Z | """
This is a middleware to respect robots.txt policies. To activate it you must
enable this middleware and enable the ROBOTSTXT_OBEY setting.
"""
import robotparser
from scrapy import signals, log
from scrapy.exceptions import NotConfigured, IgnoreRequest
from scrapy.http import Request
from scrapy.utils.httpobj im... | 35.484848 | 76 | 0.675064 |
37c3a37dcfcc9d2963b4bf2087501212fb7994c0 | 3,544 | py | Python | desktop/core/ext-py/Django-1.11/tests/managers_regress/models.py | kokosing/hue | 2307f5379a35aae9be871e836432e6f45138b3d9 | [
"Apache-2.0"
] | 5,079 | 2015-01-01T03:39:46.000Z | 2022-03-31T07:38:22.000Z | tests/managers_regress/models.py | 287977288/test | 142e3626ab3c676574631383ae6b5a4eced5a10e | [
"PSF-2.0",
"BSD-3-Clause"
] | 1,623 | 2015-01-01T08:06:24.000Z | 2022-03-30T19:48:52.000Z | tests/managers_regress/models.py | 287977288/test | 142e3626ab3c676574631383ae6b5a4eced5a10e | [
"PSF-2.0",
"BSD-3-Clause"
] | 2,033 | 2015-01-04T07:18:02.000Z | 2022-03-28T19:55:47.000Z | """
Various edge-cases for model managers.
"""
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import force_text, python_2_unicode_compatible
class OnlyFred(mo... | 23.470199 | 105 | 0.723758 |
f42e9ecf6eb650886b8a1107314c2747b0bcf0b5 | 18,060 | py | Python | pcdet/models/detectors/detector3d_template.py | penghao1990/SGNet | 99b9126a4b8ae85ba258a4150cc756ac73a7b7fb | [
"Apache-2.0"
] | 1 | 2021-12-30T10:12:38.000Z | 2021-12-30T10:12:38.000Z | pcdet/models/detectors/detector3d_template.py | penghao1990/SGNet | 99b9126a4b8ae85ba258a4150cc756ac73a7b7fb | [
"Apache-2.0"
] | null | null | null | pcdet/models/detectors/detector3d_template.py | penghao1990/SGNet | 99b9126a4b8ae85ba258a4150cc756ac73a7b7fb | [
"Apache-2.0"
] | null | null | null | import os
import torch
import torch.nn as nn
from ...ops.iou3d_nms import iou3d_nms_utils
from .. import backbones_2d, backbones_3d, dense_heads, roi_heads
from ..backbones_2d import map_to_bev
from ..backbones_3d import pfe, vfe
from ..model_utils import model_nms_utils
class Detector3DTemplate(nn.Module):
def... | 45.837563 | 111 | 0.629568 |
dc51dd62be5048150d351425bc4af70a18437739 | 476 | py | Python | 424.py | RafaelHuang87/Leet-Code-Practice | 7754dcee38ffda18a5759113ef06d7becf4fe728 | [
"MIT"
] | null | null | null | 424.py | RafaelHuang87/Leet-Code-Practice | 7754dcee38ffda18a5759113ef06d7becf4fe728 | [
"MIT"
] | null | null | null | 424.py | RafaelHuang87/Leet-Code-Practice | 7754dcee38ffda18a5759113ef06d7becf4fe728 | [
"MIT"
] | null | null | null | class Solution:
def characterReplacement(self, s: str, k: int) -> int:
import collections
count = collections.Counter()
res = 0
start = 0
for i, char in enumerate(s):
count[char] += 1
maxCnt = count.most_common(1)[0][1]
while i - start + 1 ... | 31.733333 | 58 | 0.481092 |
7d8006677b1c56389465c56214c4f24a29c11834 | 3,187 | py | Python | app.py | raynoldng/dialogflow-demo2 | f63deeff2b8d9950432596879cd95812127baedc | [
"Apache-2.0"
] | null | null | null | app.py | raynoldng/dialogflow-demo2 | f63deeff2b8d9950432596879cd95812127baedc | [
"Apache-2.0"
] | null | null | null | app.py | raynoldng/dialogflow-demo2 | f63deeff2b8d9950432596879cd95812127baedc | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import urllib
import urllib.request
import json
from dateutil import parser
from datetime import datetime, timezone
import datetime
import os
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
@app.r... | 28.455357 | 95 | 0.618764 |
df6f645aa2a8972ad82d96f3ddf57a7a333e9ff5 | 4,949 | py | Python | odeo/models/cash.py | odeoteknologi/odeo-python-sdk | 31a0b21a8b23d887fef16b09e1293091e520a23e | [
"MIT"
] | null | null | null | odeo/models/cash.py | odeoteknologi/odeo-python-sdk | 31a0b21a8b23d887fef16b09e1293091e520a23e | [
"MIT"
] | null | null | null | odeo/models/cash.py | odeoteknologi/odeo-python-sdk | 31a0b21a8b23d887fef16b09e1293091e520a23e | [
"MIT"
] | null | null | null | import dataclasses
from dataclasses import dataclass
from datetime import datetime
@dataclass
class Cash:
amount: int
currency: str
formatted_amount: str
@classmethod
def from_json(cls, json: dict):
"""Convert from JSON dictionary to :class:`Cash` object"""
return cls(
... | 25.510309 | 99 | 0.625985 |
76497f552091e53f84f8a206abce70f4e1833227 | 2,186 | py | Python | Chapter03/gpu_mandelbrot_lionel.py | liopeer/Hands-On-GPU-Programming-with-Python-and-CUDA | a4bedd805de56bb9509f878588a23618136fa502 | [
"MIT"
] | null | null | null | Chapter03/gpu_mandelbrot_lionel.py | liopeer/Hands-On-GPU-Programming-with-Python-and-CUDA | a4bedd805de56bb9509f878588a23618136fa502 | [
"MIT"
] | null | null | null | Chapter03/gpu_mandelbrot_lionel.py | liopeer/Hands-On-GPU-Programming-with-Python-and-CUDA | a4bedd805de56bb9509f878588a23618136fa502 | [
"MIT"
] | null | null | null | from time import time
import matplotlib
#this will prevent the figure from popping up
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
import pycuda.autoinit
from pycuda import gpuarray
from pycuda.elementwise import ElementwiseKernel
# first string: the input, pycuda::complex<float> is a ... | 28.763158 | 106 | 0.68527 |
d2960952880bd6b6dee1f3211383aef5a451e36a | 33,287 | py | Python | server/integrations/saml-passport/SamlPassportAuthenticator.py | duttarnab/jans-auth-server | c74d4b1056cc6ae364dee1d3b89121925a3dcd0b | [
"Apache-2.0"
] | 30 | 2020-10-08T07:42:25.000Z | 2022-01-14T08:28:54.000Z | server/integrations/saml-passport/SamlPassportAuthenticator.py | duttarnab/jans-auth-server | c74d4b1056cc6ae364dee1d3b89121925a3dcd0b | [
"Apache-2.0"
] | 339 | 2020-10-23T19:07:38.000Z | 2022-01-14T08:27:47.000Z | server/integrations/saml-passport/SamlPassportAuthenticator.py | duttarnab/jans-auth-server | c74d4b1056cc6ae364dee1d3b89121925a3dcd0b | [
"Apache-2.0"
] | 17 | 2020-10-07T17:23:59.000Z | 2022-01-14T09:28:21.000Z | # Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
# Copyright (c) 2020, Janssen Project
#
# Author: Jose Gonzalez
# Author: Yuriy Movchan
# Author: Christian Eland
#
from io.jans.jsf2.service import FacesService
from io.jans.jsf2.message import ... | 40.250302 | 236 | 0.639679 |
f0a29fed314afb880de4023511ac1a4df2d266e9 | 517 | py | Python | Lab8.py | Kiaram4/IA241-GitHub-1 | 042d5b8eb19a730441b412de9d29e97de8cc8a70 | [
"MIT"
] | null | null | null | Lab8.py | Kiaram4/IA241-GitHub-1 | 042d5b8eb19a730441b412de9d29e97de8cc8a70 | [
"MIT"
] | null | null | null | Lab8.py | Kiaram4/IA241-GitHub-1 | 042d5b8eb19a730441b412de9d29e97de8cc8a70 | [
"MIT"
] | null | null | null | '''
Lab8 Functions
'''
#3.1
def count_words(input_str):
return len(input_str.split())
#3.2
demo_str= 'hi, hello world!'
print(count_words(demo_str))
#3.3
def find_min_num(input_list):
min_item=input_list[0]
for num in input_list:
if type(num) is not str:
if min_item>=num:
... | 14.771429 | 33 | 0.601547 |
b85b5f6faad39c39c135a837d4268c2d08661b61 | 649 | py | Python | test/integration/dppl/naive/schools_naive.py | deepppl/stanc3 | 92dd65f6f7e13c95ef15fa8f5040d26265cc9817 | [
"BSD-3-Clause"
] | 17 | 2020-11-26T00:53:58.000Z | 2021-08-20T18:56:39.000Z | test/integration/dppl/naive/schools_naive.py | deepppl/stanc3 | 92dd65f6f7e13c95ef15fa8f5040d26265cc9817 | [
"BSD-3-Clause"
] | null | null | null | test/integration/dppl/naive/schools_naive.py | deepppl/stanc3 | 92dd65f6f7e13c95ef15fa8f5040d26265cc9817 | [
"BSD-3-Clause"
] | 3 | 2020-12-09T20:16:16.000Z | 2021-05-28T04:30:28.000Z | def model(N=None, sigma_y=None, y=None):
theta = zeros(N)
mu_theta = sample('mu_theta', dist.Normal(0, 100))
sigma_eta = sample('sigma_eta', dist.InverseGamma(1, 1))
eta = sample('eta', dist.Normal(zeros(N), sigma_eta))
xi = sample('xi', dist.Normal(0, 5))
theta = mu_theta + xi * eta
sample(... | 34.157895 | 72 | 0.639445 |
a57a8bc55a00972d6b010023a0160673dac35dbe | 51,524 | py | Python | pycroscopy/core/viz/plot_utils.py | ealopez/pycroscopy | 9f7c0543b67eaa0668296295fc5f492360c130a0 | [
"MIT"
] | null | null | null | pycroscopy/core/viz/plot_utils.py | ealopez/pycroscopy | 9f7c0543b67eaa0668296295fc5f492360c130a0 | [
"MIT"
] | null | null | null | pycroscopy/core/viz/plot_utils.py | ealopez/pycroscopy | 9f7c0543b67eaa0668296295fc5f492360c130a0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu May 05 13:29:12 2016
@author: Suhas Somnath, Chris R. Smith
"""
# TODO: All general plotting functions should support data with 1, 2, or 3 spatial dimensions.
from __future__ import division, print_function, absolute_import, unicode_literals
import inspect
import os
import ... | 38.710744 | 120 | 0.611715 |
b78f1effbd0ed70c26c53822c8576d3bd3708f1d | 23,949 | py | Python | HEC/ArcGeom.py | LANINCE3/LAN_INF | 6c02093e5d48fe60f672717d86a1c29571fa4b56 | [
"MIT"
] | null | null | null | HEC/ArcGeom.py | LANINCE3/LAN_INF | 6c02093e5d48fe60f672717d86a1c29571fa4b56 | [
"MIT"
] | null | null | null | HEC/ArcGeom.py | LANINCE3/LAN_INF | 6c02093e5d48fe60f672717d86a1c29571fa4b56 | [
"MIT"
] | null | null | null | import os
import arcpy
import traceback
from Geom import get_legs, pi, getTheta, get_segment_length
from math import sin, cos, hypot
import bisect
from gc import collect
def buffer_inlets_and_roadside(line_feature, point_feature, output_feature, buff_distance):
buf_point_fc = os.path.join(os.path.dirname(... | 55.182028 | 122 | 0.412877 |
a78fd7aa04f213462509f4072d37c76f8d980f90 | 3,843 | py | Python | pybullet-gym/pybulletgym/envs/mujoco/robots/locomotors/walker_base.py | SmaleZ/vcl_diayn | b2c47a681675b405d2011bc4a43c3914f3af4ecc | [
"MIT"
] | 2 | 2021-07-12T17:11:35.000Z | 2021-07-13T05:56:30.000Z | pybullet-gym/pybulletgym/envs/mujoco/robots/locomotors/walker_base.py | SmaleZ/vcl_diayn | b2c47a681675b405d2011bc4a43c3914f3af4ecc | [
"MIT"
] | null | null | null | pybullet-gym/pybulletgym/envs/mujoco/robots/locomotors/walker_base.py | SmaleZ/vcl_diayn | b2c47a681675b405d2011bc4a43c3914f3af4ecc | [
"MIT"
] | null | null | null | from pybulletgym.envs.mujoco.robots.robot_bases import XmlBasedRobot
import numpy as np
class WalkerBase(XmlBasedRobot):
def __init__(self, power):
self.power = power
self.camera_x = 0
self.start_pos_x, self.start_pos_y, self.start_pos_z = 0, 0, 0
self.walk_target_x = 1e3 # kilome... | 45.211765 | 154 | 0.583659 |
48dc113f30e7be8854538555da990e232f0295b9 | 7,516 | py | Python | DEAL/02_ResNet/utils/resnet_utils.py | ptrckhmmr/DEAL | 164ba36a21f7f779557e025bd5acc8a4a42f01a1 | [
"Apache-2.0"
] | 13 | 2020-10-08T20:40:49.000Z | 2022-03-12T07:21:39.000Z | DEAL/02_ResNet/utils/resnet_utils.py | DeepLearningResearch/DEAL | 164ba36a21f7f779557e025bd5acc8a4a42f01a1 | [
"Apache-2.0"
] | null | null | null | DEAL/02_ResNet/utils/resnet_utils.py | DeepLearningResearch/DEAL | 164ba36a21f7f779557e025bd5acc8a4a42f01a1 | [
"Apache-2.0"
] | 1 | 2021-01-21T09:32:22.000Z | 2021-01-21T09:32:22.000Z | import tensorflow as tf
import tensorflow.contrib.slim as slim
import os
from keras.datasets import cifar10, cifar100, mnist
from keras.utils import to_categorical
import numpy as np
import random
from scipy import misc
import os
import shutil
def check_folder(log_dir):
if not os.path.exists(log_dir):
os.m... | 29.825397 | 84 | 0.639037 |
bc47bd1b17af88e0259a3a2f534f38365ba59f3a | 862 | py | Python | docker/ngram/ngram_scripts/build_recommender.py | smsahu/seldon-server | 7f6dc5d405736e44205323f04ce431064dd854b3 | [
"Apache-2.0"
] | 1,645 | 2015-02-13T12:31:44.000Z | 2022-03-17T07:50:05.000Z | docker/ngram/ngram_scripts/build_recommender.py | smsahu/seldon-server | 7f6dc5d405736e44205323f04ce431064dd854b3 | [
"Apache-2.0"
] | 57 | 2015-03-26T16:00:23.000Z | 2021-05-10T11:03:40.000Z | docker/ngram/ngram_scripts/build_recommender.py | smsahu/seldon-server | 7f6dc5d405736e44205323f04ce431064dd854b3 | [
"Apache-2.0"
] | 371 | 2015-03-16T11:04:16.000Z | 2022-02-27T01:16:02.000Z | import sys, getopt, argparse
from seldon.text.ngram_recommend import NgramModel
if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='upload model')
parser.add_argument('--arpa', help='arpa file', required=True)
parser.add_argument('--dst', help='dst folder', required=True)
parser.add_argu... | 31.925926 | 105 | 0.701856 |
4584772afe0682a40a2f4b318d9c7f8b0ee623c6 | 11,232 | py | Python | advanced_functionality/distributed_tensorflow_mask_rcnn/container-optimized/resources/train.py | nikhilarunw/amazon-sagemaker-examples | 9fd2156b329fba087881b19d86aa68b5f5b50c7b | [
"Apache-2.0"
] | null | null | null | advanced_functionality/distributed_tensorflow_mask_rcnn/container-optimized/resources/train.py | nikhilarunw/amazon-sagemaker-examples | 9fd2156b329fba087881b19d86aa68b5f5b50c7b | [
"Apache-2.0"
] | 4 | 2020-09-26T00:53:42.000Z | 2022-02-10T01:41:50.000Z | advanced_functionality/distributed_tensorflow_mask_rcnn/container-optimized/resources/train.py | nikhilarunw/amazon-sagemaker-examples | 9fd2156b329fba087881b19d86aa68b5f5b50c7b | [
"Apache-2.0"
] | 1 | 2020-04-12T17:19:16.000Z | 2020-04-12T17:19:16.000Z | import json
import os
import shutil
import subprocess
import sys
import time
import signal
import socket
import glob
from contextlib import contextmanager
def setup():
# Read info that SageMaker provides
current_host = os.environ['SM_CURRENT_HOST']
hosts = json.loads(os.environ['SM_HOSTS'])
# Enable... | 29.480315 | 136 | 0.646724 |
ddadd018562d12cd71369e27fbab64834eb52d16 | 3,559 | py | Python | example/django1_10/bugsnag_demo/settings.py | rajeev02101987/bugsnag-python | 84d6339dbfb9cc6068a972bca219836a402e0a74 | [
"MIT"
] | null | null | null | example/django1_10/bugsnag_demo/settings.py | rajeev02101987/bugsnag-python | 84d6339dbfb9cc6068a972bca219836a402e0a74 | [
"MIT"
] | null | null | null | example/django1_10/bugsnag_demo/settings.py | rajeev02101987/bugsnag-python | 84d6339dbfb9cc6068a972bca219836a402e0a74 | [
"MIT"
] | null | null | null | """
Django settings for bugsnag_demo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... | 30.161017 | 140 | 0.730261 |
dc5c675c60d4765e97dddfa07d7825520fe1db3b | 540 | py | Python | Python-Data-structure/WEEK 6/ex_10.py | mhmdreda99/Python-for-everybody-specializaion | 9a520111bc4837b92709e0ffe54094bc184642d7 | [
"MIT"
] | null | null | null | Python-Data-structure/WEEK 6/ex_10.py | mhmdreda99/Python-for-everybody-specializaion | 9a520111bc4837b92709e0ffe54094bc184642d7 | [
"MIT"
] | null | null | null | Python-Data-structure/WEEK 6/ex_10.py | mhmdreda99/Python-for-everybody-specializaion | 9a520111bc4837b92709e0ffe54094bc184642d7 | [
"MIT"
] | null | null | null | fname = input('Enter File: ')
if len(fname) < 1:
fname = 'clown.txt'
hand = open(fname)
di = dict()
for lin in hand:
lin = lin.rstrip()
wds = lin.split()
for w in wds:
di[w] = di.get(w,0) + 1
#print(di)
# new code starts from here
#x = sotred(di.items())
#print(x[:5])
#flip for sorting
t... | 15.882353 | 31 | 0.57037 |
7dff31518f5735d3790d4eb73fd163eef67d9e5e | 1,317 | py | Python | mindspore/ops/_op_impl/tbe/tanh.py | GuoSuiming/mindspore | 48afc4cfa53d970c0b20eedfb46e039db2a133d5 | [
"Apache-2.0"
] | 3,200 | 2020-02-17T12:45:41.000Z | 2022-03-31T20:21:16.000Z | mindspore/ops/_op_impl/tbe/tanh.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | 176 | 2020-02-12T02:52:11.000Z | 2022-03-28T22:15:55.000Z | mindspore/ops/_op_impl/tbe/tanh.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | 621 | 2020-03-09T01:31:41.000Z | 2022-03-30T03:43:19.000Z | # Copyright 2020 Huawei Technologies Co., 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 applicable law or agreed to... | 34.657895 | 79 | 0.668185 |
53c38d1d8a98cd22445ad182e4767bcadbedf8e4 | 12,030 | py | Python | evolution/uLoadCvode.py | really-lilly/oldEv | 64ce05d991f96fdca9a3170837e5e5e17f584cac | [
"MIT"
] | 1 | 2021-09-28T19:57:07.000Z | 2021-09-28T19:57:07.000Z | evolution/uLoadCvode.py | really-lilly/oldEv | 64ce05d991f96fdca9a3170837e5e5e17f584cac | [
"MIT"
] | 1 | 2022-02-17T21:19:53.000Z | 2022-02-17T21:19:53.000Z | evolution/uLoadCvode.py | really-lilly/oldEv | 64ce05d991f96fdca9a3170837e5e5e17f584cac | [
"MIT"
] | null | null | null | '''
Author: Ciaran Welsh & Lillian Tatka
The purpose of this script is to load the sundials module and interface with it.
'''
import ctypes as ct
from typing import List
from distro import id
import numpy as np
from os.path import exists, join, dirname, isdir
from sys import platform
from pathlib import... | 39.442623 | 143 | 0.655777 |
560c41e842c82019e482839c2885ec28eb1d9dcb | 39,521 | py | Python | neural-machine-translation/t/text_encoder.py | SunYanCN/NLP-Models-Tensorflow | 0741216aa8235e1228b3de7903cc36d73f8f2b45 | [
"MIT"
] | 1,705 | 2018-11-03T17:34:22.000Z | 2022-03-29T04:30:01.000Z | neural-machine-translation/t/text_encoder.py | SunYanCN/NLP-Models-Tensorflow | 0741216aa8235e1228b3de7903cc36d73f8f2b45 | [
"MIT"
] | 26 | 2019-03-16T17:23:00.000Z | 2021-10-08T08:06:09.000Z | neural-machine-translation/t/text_encoder.py | SunYanCN/NLP-Models-Tensorflow | 0741216aa8235e1228b3de7903cc36d73f8f2b45 | [
"MIT"
] | 705 | 2018-11-03T17:34:25.000Z | 2022-03-24T02:29:14.000Z | # coding=utf-8
# Copyright 2020 The Tensor2Tensor 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... | 34.455972 | 87 | 0.619696 |
1ce7d7f5a982b381c900935b7b85852a99891712 | 1,613 | py | Python | observations/r/litters.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 199 | 2017-07-24T01:34:27.000Z | 2022-01-29T00:50:55.000Z | observations/r/litters.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 46 | 2017-09-05T19:27:20.000Z | 2019-01-07T09:47:26.000Z | observations/r/litters.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 45 | 2017-07-26T00:10:44.000Z | 2022-03-16T20:44:59.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def litters(path):
"""Mouse Litters
Data on the body and brain weights... | 26.442623 | 74 | 0.698078 |
81f8b6009b0f1bf979bc5394fc80662b1d06675f | 1,516 | py | Python | app.py | boweihan/NLPPlayground | 17ad1bc989a6d98fcc11cede0ab728abd5d7df42 | [
"MIT"
] | null | null | null | app.py | boweihan/NLPPlayground | 17ad1bc989a6d98fcc11cede0ab728abd5d7df42 | [
"MIT"
] | 16 | 2021-01-06T08:10:37.000Z | 2022-03-27T06:27:48.000Z | app.py | boweihan/NLPPlayground | 17ad1bc989a6d98fcc11cede0ab728abd5d7df42 | [
"MIT"
] | null | null | null | import stanza
# packages are downloaded separately to minimize startup time for Heroku deployment
stanza.download("en", package="ewt")
stanza.download("en", package="OntoNotes")
from flask import Flask, request
from flask_cors import CORS, cross_origin
from twilio.twiml.messaging_response import MessagingResponse
fro... | 27.071429 | 83 | 0.693272 |
fbc8f4b5aaf0e54ec3c4b2f43e25e5069b3dd332 | 30,073 | py | Python | adaptft/tft.py | alexberrian/AdapTFT | 263a4d25669f6f87039d1dafd386cdc7838bde9e | [
"BSD-3-Clause"
] | null | null | null | adaptft/tft.py | alexberrian/AdapTFT | 263a4d25669f6f87039d1dafd386cdc7838bde9e | [
"BSD-3-Clause"
] | null | null | null | adaptft/tft.py | alexberrian/AdapTFT | 263a4d25669f6f87039d1dafd386cdc7838bde9e | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
from adaptft.audio_io import AudioSignal
from copy import deepcopy
# from typing import Callable
# from typing import Generator
TWOPI = np.pi * 2
class TFTransformer(object):
def __init__(self, filename):
self.AudioSignal = AudioSignal(filename)
self.param_dict = {}
se... | 52.119584 | 120 | 0.606757 |
f74674d3d04e992c9b38b8f5f7cfef8b4888cf75 | 1,290 | py | Python | cycling_in_france/helper_func.py | nenb/cycling_in_france | 6cddc433a2136f52be996719db0a1d876fcf5c59 | [
"MIT"
] | null | null | null | cycling_in_france/helper_func.py | nenb/cycling_in_france | 6cddc433a2136f52be996719db0a1d876fcf5c59 | [
"MIT"
] | null | null | null | cycling_in_france/helper_func.py | nenb/cycling_in_france | 6cddc433a2136f52be996719db0a1d876fcf5c59 | [
"MIT"
] | null | null | null | import regionmask
import numpy as np
import dask
def create_windmax_dict(u, v, names, borders, longitude, latitude):
"""Produce a dictionary of masked maximum wind speeds in units of mph."""
if u.units != "m s**-1":
raise ValueError("U field does not have units m/s")
if v.units != "m s**-1":
... | 40.3125 | 79 | 0.662791 |
c5de5f409109c1624a68f693d4f556e0e227cd13 | 4,542 | py | Python | pyabc/sge/db.py | Gabriel-p/pyABC | a1c963203c9f9e3fa40793ccf214753fb689d27f | [
"BSD-3-Clause"
] | null | null | null | pyabc/sge/db.py | Gabriel-p/pyABC | a1c963203c9f9e3fa40793ccf214753fb689d27f | [
"BSD-3-Clause"
] | null | null | null | pyabc/sge/db.py | Gabriel-p/pyABC | a1c963203c9f9e3fa40793ccf214753fb689d27f | [
"BSD-3-Clause"
] | null | null | null | import os
import sqlite3
import time
import redis
from .config import get_config
def within_time(job_start_time, max_run_time_h):
return time.time() - job_start_time < max_run_time_h * 1.1 * 3600
class SQLiteJobDB:
SQLITE_DB_TIMEOUT = 2000
def __init__(self, tmp_dir):
self.connection = sqlite... | 29.303226 | 79 | 0.570233 |
70f451775205a648d2ab827293e6eb5db45200eb | 890 | py | Python | app/context_processors.py | Axiacore/knowledge-base | edf78e0bc1e0e4334f77b5785749408ba426627d | [
"MIT"
] | 9 | 2016-06-10T21:24:15.000Z | 2018-03-05T15:43:20.000Z | app/context_processors.py | Axiacore/knowledge-base | edf78e0bc1e0e4334f77b5785749408ba426627d | [
"MIT"
] | 3 | 2016-06-14T19:23:38.000Z | 2016-10-12T16:33:27.000Z | app/context_processors.py | Axiacore/knowledge-base | edf78e0bc1e0e4334f77b5785749408ba426627d | [
"MIT"
] | 5 | 2016-06-14T13:02:26.000Z | 2019-09-19T21:08:14.000Z | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: AxiaCore S.A.S. http://axiacore.com
from django.conf import settings
from django.utils.safestring import mark_safe
from string import Template
TRACKING_CODE = """
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};
ga.l=+new Date;
ga('cre... | 23.421053 | 75 | 0.644944 |
b056012ca7196a9f722aab62488de68928721578 | 159 | py | Python | itam/it_asset_management/doctype/itam_asset/test_itam_asset.py | Res-IT-Solutions/ITAM | 70a5ab7da17395d8c2b7adb7954b104dd9f03c91 | [
"MIT"
] | null | null | null | itam/it_asset_management/doctype/itam_asset/test_itam_asset.py | Res-IT-Solutions/ITAM | 70a5ab7da17395d8c2b7adb7954b104dd9f03c91 | [
"MIT"
] | null | null | null | itam/it_asset_management/doctype/itam_asset/test_itam_asset.py | Res-IT-Solutions/ITAM | 70a5ab7da17395d8c2b7adb7954b104dd9f03c91 | [
"MIT"
] | 1 | 2022-03-23T12:33:13.000Z | 2022-03-23T12:33:13.000Z | # Copyright (c) 2021, Res-IT Solutions Ltd. and Contributors
# See license.txt
# import frappe
import unittest
class TestITAMAsset(unittest.TestCase):
pass
| 17.666667 | 60 | 0.773585 |
06c7edf28f4a3fffbf0dd90b353486c2e6414743 | 8,365 | py | Python | WarpDrive/WarpDriveLib/Tools/DrawTool.py | simonoxen/SlicerNetstim | 52e3abf486fa67f853e5197ace755398cdbdbb7e | [
"BSD-3-Clause"
] | null | null | null | WarpDrive/WarpDriveLib/Tools/DrawTool.py | simonoxen/SlicerNetstim | 52e3abf486fa67f853e5197ace755398cdbdbb7e | [
"BSD-3-Clause"
] | null | null | null | WarpDrive/WarpDriveLib/Tools/DrawTool.py | simonoxen/SlicerNetstim | 52e3abf486fa67f853e5197ace755398cdbdbb7e | [
"BSD-3-Clause"
] | null | null | null | import qt, vtk, slicer
import numpy as np
from ..Widgets.ToolWidget import AbstractToolWidget
from ..Effects.DrawEffect import AbstractDrawEffect
from ..Helpers import GridNodeHelper, WarpDriveUtil
class DrawToolWidget(AbstractToolWidget):
def __init__(self):
toolTip = ''
AbstractToolWidget.__init__(... | 39.2723 | 186 | 0.736402 |
125224bd8e29332a724348f8b627a69969e63866 | 649 | py | Python | price.py | indiBlockDev/CryptoIndiaBot | d6b7b9c1e797426688db0d1c05975d086d4095d6 | [
"MIT"
] | null | null | null | price.py | indiBlockDev/CryptoIndiaBot | d6b7b9c1e797426688db0d1c05975d086d4095d6 | [
"MIT"
] | null | null | null | price.py | indiBlockDev/CryptoIndiaBot | d6b7b9c1e797426688db0d1c05975d086d4095d6 | [
"MIT"
] | null | null | null | import requests
import time
price = ""
def store(name,url):
global price
data = requests.get(url).json()
if "Coinsecure" in name:
bid = data["bid"]
ask = data["ask"]
else:
bid = data["buy"]
ask = data["sell"]
if("Coinsecure" in name):
price = "Coinsecure : \nBid : %s Ask : %s\n" %(bid/100,ask/... | 19.088235 | 73 | 0.625578 |
1719c62da08f708b0ba25f21d9cb3e56faa43376 | 3,237 | py | Python | improver/utilities/cube_constraints.py | cgsandford/improver | 3cfbf3323d3a693a9c61fec13350295b85d03676 | [
"BSD-3-Clause"
] | 1 | 2021-08-02T21:17:18.000Z | 2021-08-02T21:17:18.000Z | improver/utilities/cube_constraints.py | NMC-DAVE/improver | b56379f8bd236ddf2bab31ef64af8345de856cc1 | [
"BSD-3-Clause"
] | 4 | 2018-01-24T11:29:15.000Z | 2021-01-11T15:16:21.000Z | improver/utilities/cube_constraints.py | cgsandford/improver | 3cfbf3323d3a693a9c61fec13350295b85d03676 | [
"BSD-3-Clause"
] | 1 | 2021-08-02T21:17:19.000Z | 2021-08-02T21:17:19.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | 44.342466 | 79 | 0.711152 |
48e64c9cf1705560716a3683378fe07828ec08d7 | 6,374 | py | Python | test/unit/pulled_search/process_files.py | mjpernot/pulled-search | 2c8f4dee420f0c2fc12867b2a642e3a530d2f24c | [
"MIT"
] | null | null | null | test/unit/pulled_search/process_files.py | mjpernot/pulled-search | 2c8f4dee420f0c2fc12867b2a642e3a530d2f24c | [
"MIT"
] | null | null | null | test/unit/pulled_search/process_files.py | mjpernot/pulled-search | 2c8f4dee420f0c2fc12867b2a642e3a530d2f24c | [
"MIT"
] | null | null | null | #!/usr/bin/python
# Classification (U)
"""Program: process_files.py
Description: Unit testing of process_files in pulled_search.py.
Usage:
test/unit/pulled_search/process_files.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version_info < (2, 7):
... | 28.711712 | 79 | 0.630844 |
ceeb572f340af7dc5d5a346305ec18b7f45c2ed7 | 922 | py | Python | bims/management/commands/update_long_lat_locationsite.py | Christiaanvdm/django-bims | f92a63156c711b2d53c5f8ea06867cd64cee9eb9 | [
"MIT"
] | null | null | null | bims/management/commands/update_long_lat_locationsite.py | Christiaanvdm/django-bims | f92a63156c711b2d53c5f8ea06867cd64cee9eb9 | [
"MIT"
] | null | null | null | bims/management/commands/update_long_lat_locationsite.py | Christiaanvdm/django-bims | f92a63156c711b2d53c5f8ea06867cd64cee9eb9 | [
"MIT"
] | null | null | null | from django.core.management.base import BaseCommand
from django.contrib.gis.db import models
from django.db.models import Q
from bims.models.location_site import (
location_site_post_save_handler,
LocationSite
)
class Command(BaseCommand):
"""Update taxa.
"""
def handle(self, *args, **options):
... | 25.611111 | 53 | 0.625813 |
bef41b9281dc6ce244afb61b34be82fcd526250f | 365 | py | Python | sleuth_crawler/scraper/scraper/customcontext.py | ubclaunchpad/sleuth | 7b7be0b7097a26169e17037f4220fd0ce039bde1 | [
"MIT"
] | 12 | 2017-09-17T02:14:35.000Z | 2022-01-09T10:14:59.000Z | sleuth_crawler/scraper/scraper/customcontext.py | ubclaunchpad/sleuth | 7b7be0b7097a26169e17037f4220fd0ce039bde1 | [
"MIT"
] | 92 | 2017-09-16T23:50:45.000Z | 2018-01-02T01:56:33.000Z | sleuth_crawler/scraper/scraper/customcontext.py | ubclaunchpad/sleuth | 7b7be0b7097a26169e17037f4220fd0ce039bde1 | [
"MIT"
] | 5 | 2017-12-26T01:47:36.000Z | 2021-12-31T11:15:07.000Z | from OpenSSL import SSL
from scrapy.core.downloader.contextfactory import ScrapyClientContextFactory
class CustomContextFactory(ScrapyClientContextFactory):
"""
Custom context factory that allows SSL negotiation.
"""
def __init__(self, method):
# Use SSLv23_METHOD so we can use protocol negoti... | 33.181818 | 76 | 0.758904 |
955bdf46af50519c1d2655aebc3253aa81ff1999 | 2,024 | py | Python | src/tests/ftest/util/GeneralUtils.py | phylcrandall/daos | 7a6adf9733f12538afcea44cced450b0fd4ad31d | [
"Apache-2.0"
] | null | null | null | src/tests/ftest/util/GeneralUtils.py | phylcrandall/daos | 7a6adf9733f12538afcea44cced450b0fd4ad31d | [
"Apache-2.0"
] | null | null | null | src/tests/ftest/util/GeneralUtils.py | phylcrandall/daos | 7a6adf9733f12538afcea44cced450b0fd4ad31d | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
'''
(C) Copyright 2018 Intel Corporation.
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 ... | 36.142857 | 79 | 0.682806 |
e852edc72bf5e25c45467cefec859744216113e1 | 43,517 | py | Python | program/views.py | Dumbaz/autoradio-pv | 8aae293e58b2e79a05956c535bb109f74edc89c3 | [
"BSD-3-Clause"
] | null | null | null | program/views.py | Dumbaz/autoradio-pv | 8aae293e58b2e79a05956c535bb109f74edc89c3 | [
"BSD-3-Clause"
] | null | null | null | program/views.py | Dumbaz/autoradio-pv | 8aae293e58b2e79a05956c535bb109f74edc89c3 | [
"BSD-3-Clause"
] | null | null | null | import json
from datetime import date, datetime, time, timedelta
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.models import User
from django.http import Http404, HttpResponse, JsonResponse
from djan... | 38.647425 | 252 | 0.636165 |
9b0414f20ac30c39c640b31c79da4965694083fa | 1,117 | py | Python | news_pipeline/queue_helper.py | yanyang729/news-recommendation | 0cd2e2e84f94507a339077753e367cf8bef9e36e | [
"MIT"
] | 4 | 2017-11-16T15:00:23.000Z | 2018-03-08T16:28:26.000Z | news_pipeline/queue_helper.py | yanyang729/news-recommendation | 0cd2e2e84f94507a339077753e367cf8bef9e36e | [
"MIT"
] | null | null | null | news_pipeline/queue_helper.py | yanyang729/news-recommendation | 0cd2e2e84f94507a339077753e367cf8bef9e36e | [
"MIT"
] | null | null | null | import os
import sys
# import common package in parent directory
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
import news_api_client
from cloudAMQP_client import CloundAMQPClient as CloudAMQPClient
DEDUPE_NEWS_TASK_QUEUE_URL = "amqp://rcsdmawz:QDrDPYaGXyAA0WU8NiVWopTTH3yVkULw@wasp.rmq.clo... | 36.032258 | 112 | 0.761862 |
47fd8afe68f42294edde0122b590d7c87b71ea92 | 831 | py | Python | gan/progan/auxiliary.py | valentingol/GANJax | ebcb8f4412277da2d9bda80282c2842d111bf393 | [
"MIT"
] | 9 | 2021-11-20T18:25:37.000Z | 2021-12-13T23:32:35.000Z | gan/progan/auxiliary.py | valentingol/GANJax | ebcb8f4412277da2d9bda80282c2842d111bf393 | [
"MIT"
] | 4 | 2021-12-04T15:30:58.000Z | 2022-01-20T13:13:32.000Z | gan/progan/auxiliary.py | valentingol/GANJax | ebcb8f4412277da2d9bda80282c2842d111bf393 | [
"MIT"
] | 3 | 2022-01-18T00:02:30.000Z | 2022-03-10T09:22:43.000Z | from jax import jit, numpy as jnp, random
def upsample_2d(x, scale):
x = jnp.repeat(x, scale, axis=1)
x = jnp.repeat(x, scale, axis=2)
return x
@jit
def add_batch_std(x):
shape = x.shape
mean = jnp.mean(x, axis=0, keepdims=True)
# Variance over the batch:
var = jnp.mean(jnp.square(x - me... | 24.441176 | 70 | 0.619735 |
c7ddda2f0a5ae68def9e2f41f0b6e65027780863 | 386 | py | Python | account/migrations/0007_auto_20190809_2257.py | jongwooo/TruckWassup | 553a940062c1aa13bc26bb99b8357470cc21dfdb | [
"MIT"
] | 1 | 2020-07-23T03:22:47.000Z | 2020-07-23T03:22:47.000Z | account/migrations/0007_auto_20190809_2257.py | jongwooo/TruckWassup | 553a940062c1aa13bc26bb99b8357470cc21dfdb | [
"MIT"
] | 7 | 2020-06-05T22:47:48.000Z | 2022-03-11T23:55:47.000Z | account/migrations/0007_auto_20190809_2257.py | jongwooo/TruckWassup | 553a940062c1aa13bc26bb99b8357470cc21dfdb | [
"MIT"
] | null | null | null | # Generated by Django 2.2.4 on 2019-08-09 13:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0006_profile_company'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='company',
... | 20.315789 | 51 | 0.598446 |
eeada57e5fe392e65475d6cc827875665a1715ef | 2,522 | py | Python | src/tf_transformers/layers/mask/cross_attention_mask.py | s4sarath/tf-transformers | 361f7b01c7816034ddfc8661f8b6a967835bc1de | [
"Apache-2.0"
] | 2 | 2021-03-31T17:48:16.000Z | 2021-08-22T11:52:19.000Z | src/tf_transformers/layers/mask/cross_attention_mask.py | Vibha111094/tf-transformers | f26d440a4de0557e0e481279bfd70a732aaa8825 | [
"Apache-2.0"
] | null | null | null | src/tf_transformers/layers/mask/cross_attention_mask.py | Vibha111094/tf-transformers | f26d440a4de0557e0e481279bfd70a732aaa8825 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 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... | 39.40625 | 97 | 0.681205 |
341e245b9afcbc71f451b7d438c82e51c93ecd88 | 441 | py | Python | api/model/crud/crud.py | PatrickVuscan/React-Native-Fast-API-Pizzeria | 9a0747b6db77ed7d5a2e9795e9a159da6e490ccf | [
"MIT"
] | 1 | 2020-12-20T20:40:38.000Z | 2020-12-20T20:40:38.000Z | api/model/crud/crud.py | PatrickVuscan/React-Native-Fast-API-Pizzeria | 9a0747b6db77ed7d5a2e9795e9a159da6e490ccf | [
"MIT"
] | null | null | null | api/model/crud/crud.py | PatrickVuscan/React-Native-Fast-API-Pizzeria | 9a0747b6db77ed7d5a2e9795e9a159da6e490ccf | [
"MIT"
] | null | null | null | """Aggregate all model CRUD operations."""
from .pizza_crud import SqlPizzaCRUD
from .customer_crud import SqlCustomerCRUD
from .drink_crud import SqlDrinkCRUD
from .topping_crud import SqlToppingCRUD
from .order_crud import SqlOrderCRUD
# pylint: disable=too-many-ancestors
class Crud(SqlPizzaCRUD, SqlCustomerCRUD, S... | 36.75 | 86 | 0.814059 |
f46a022a88ff92d9e7d5aae48a4800a53a7d2295 | 713 | py | Python | Snippets/20220126.py | DZL1943/geeknotes | 2ea9f7c1048784dc4bf879105d0053bf2b8cd619 | [
"MIT"
] | null | null | null | Snippets/20220126.py | DZL1943/geeknotes | 2ea9f7c1048784dc4bf879105d0053bf2b8cd619 | [
"MIT"
] | null | null | null | Snippets/20220126.py | DZL1943/geeknotes | 2ea9f7c1048784dc4bf879105d0053bf2b8cd619 | [
"MIT"
] | null | null | null | # 用 python 处理命令输出的一个例子
# date: 20220126
import os
def _f():
r = os.popen("grep -o 'hs\.[a-zA-Z]*' ~/.hammerspoon/init.lua | sort|uniq")
lines = r.read().splitlines()
return lines
lines = [
'hs.alert',
'hs.application',
'hs.canvas',
'hs.configdir',
'hs.eventtap',
'hs.fnutils',
... | 17.825 | 79 | 0.54979 |
979621339ff06f4fc345b265c2a0b55cc585dbef | 1,106 | py | Python | public/code/saveMetaData.py | xrachitx/audioRecordJS | bc16d736a4ccb613b8032b927cea48b2a7185447 | [
"Apache-2.0"
] | null | null | null | public/code/saveMetaData.py | xrachitx/audioRecordJS | bc16d736a4ccb613b8032b927cea48b2a7185447 | [
"Apache-2.0"
] | null | null | null | public/code/saveMetaData.py | xrachitx/audioRecordJS | bc16d736a4ccb613b8032b927cea48b2a7185447 | [
"Apache-2.0"
] | null | null | null | import argparse
import os
import json
parser = argparse.ArgumentParser()
parser.add_argument("fileAddr",help = "File name for the recorded audio",type= str)
parser.add_argument("txt",help = "txt file details",type= str)
parser.add_argument("age",help = "Age",type= str)
parser.add_argument("gender",help = "Gender",type... | 29.105263 | 83 | 0.708861 |
804abb5e8b92340b5605f522e45d3b94474670ae | 3,240 | py | Python | orm_sqlite/model.py | yzhang-dev/ORM-SQLite | ec0e67490840601bc3ba4b5e5a694e919aac02be | [
"MIT"
] | null | null | null | orm_sqlite/model.py | yzhang-dev/ORM-SQLite | ec0e67490840601bc3ba4b5e5a694e919aac02be | [
"MIT"
] | null | null | null | orm_sqlite/model.py | yzhang-dev/ORM-SQLite | ec0e67490840601bc3ba4b5e5a694e919aac02be | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .manager import Manager, classonlymethod
from .logger import child_logger
logger = child_logger('orm_sqlite.model')
class Field(object):
def __init__(self, name, type, default, primary_key):
self.name = name
self.type = type
self.defaul... | 30.566038 | 99 | 0.60463 |
3c5379aa59e8b14bda047687f04505a16ea16754 | 1,117 | py | Python | tests/components/august/test_camera.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 30,023 | 2016-04-13T10:17:53.000Z | 2020-03-02T12:56:31.000Z | tests/components/august/test_camera.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 31,101 | 2020-03-02T13:00:16.000Z | 2022-03-31T23:57:36.000Z | tests/components/august/test_camera.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 11,956 | 2016-04-13T18:42:31.000Z | 2020-03-02T09:32:12.000Z | """The camera tests for the august platform."""
from http import HTTPStatus
from unittest.mock import patch
from homeassistant.const import STATE_IDLE
from tests.components.august.mocks import (
_create_august_with_devices,
_mock_doorbell_from_fixture,
)
async def test_create_doorbell(hass, hass_client_no_... | 30.189189 | 84 | 0.702775 |
5a33052c4472c357bdc4d6909727b7ba60d5047b | 13,248 | py | Python | tests/kafkatest/services/console_consumer.py | testadmin1-levelops/kafka | 87734144c4f73dfa4838dbdefcf8b89a1c3b4f69 | [
"Apache-2.0"
] | null | null | null | tests/kafkatest/services/console_consumer.py | testadmin1-levelops/kafka | 87734144c4f73dfa4838dbdefcf8b89a1c3b4f69 | [
"Apache-2.0"
] | null | null | null | tests/kafkatest/services/console_consumer.py | testadmin1-levelops/kafka | 87734144c4f73dfa4838dbdefcf8b89a1c3b4f69 | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | 48.527473 | 126 | 0.603563 |
4353094eba973b7e06a9368bf1bbf0aaeff99dc4 | 1,726 | py | Python | raffle.py | codeburr/pyraffle | 6ef6f0949a1e1fb09c71b9dc37c7b5c34494c95e | [
"MIT"
] | null | null | null | raffle.py | codeburr/pyraffle | 6ef6f0949a1e1fb09c71b9dc37c7b5c34494c95e | [
"MIT"
] | null | null | null | raffle.py | codeburr/pyraffle | 6ef6f0949a1e1fb09c71b9dc37c7b5c34494c95e | [
"MIT"
] | null | null | null | from sys import exit
import os
import random
def clear():
os.system("cls" if os.name=="nt" else "clear")
return
def raffle(wins,shuffles=3):
names=[]
winners=[]
with open("./names.txt","r") as f:
lines=f.readlines()
if wins<0: wins=abs(wins)
if wins>len(lines): wins=len(line... | 25.761194 | 73 | 0.542294 |
6d9b69e9a93158e746fd7b282467f40b50ac7f79 | 1,767 | py | Python | nsofetch/fetch_uk.py | FullFact/nso-stats-fetcher | 7d279b7e885951ba69cd34c0e0a45e5ec8333549 | [
"MIT"
] | null | null | null | nsofetch/fetch_uk.py | FullFact/nso-stats-fetcher | 7d279b7e885951ba69cd34c0e0a45e5ec8333549 | [
"MIT"
] | null | null | null | nsofetch/fetch_uk.py | FullFact/nso-stats-fetcher | 7d279b7e885951ba69cd34c0e0a45e5ec8333549 | [
"MIT"
] | null | null | null | import json
import csv
import requests
import filepaths
import utils
def month_name_to_num(month_name):
month_map = {
'January': '01', 'February': '02', 'March': '03', 'April': '04', 'May': '05', 'June': '06',
'July': '07', 'August': '08', 'September': '09', 'October': '10', 'November': '11', '... | 31.553571 | 109 | 0.66893 |
453bc11ae253de1b8dd0222840c48eb08a6607c3 | 8,031 | py | Python | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/plugins/modules/web_infrastructure/apache2_module.py | tr3ck3r/linklight | 5060f624c235ecf46cb62cefcc6bddc6bf8ca3e7 | [
"MIT"
] | null | null | null | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/plugins/modules/web_infrastructure/apache2_module.py | tr3ck3r/linklight | 5060f624c235ecf46cb62cefcc6bddc6bf8ca3e7 | [
"MIT"
] | null | null | null | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/plugins/modules/web_infrastructure/apache2_module.py | tr3ck3r/linklight | 5060f624c235ecf46cb62cefcc6bddc6bf8ca3e7 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# coding: utf-8 -*-
# (c) 2013-2014, Christian Berendt <berendt@b1-systems.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': ... | 30.420455 | 133 | 0.62321 |
0b4587c7e967242617f409d78d67f350571efe4e | 790 | py | Python | fslks/eval/accuracy.py | opscidia/mtft_zsl | 2b3b524e9b50e27ed80ebf9e514fedb5eed9954f | [
"MIT"
] | 1 | 2020-12-08T04:28:50.000Z | 2020-12-08T04:28:50.000Z | fslks/eval/accuracy.py | opscidia/mtft_zsl | 2b3b524e9b50e27ed80ebf9e514fedb5eed9954f | [
"MIT"
] | null | null | null | fslks/eval/accuracy.py | opscidia/mtft_zsl | 2b3b524e9b50e27ed80ebf9e514fedb5eed9954f | [
"MIT"
] | 1 | 2021-08-25T11:01:37.000Z | 2021-08-25T11:01:37.000Z | def sentence_accuracy(references, predictions):
"""Compute accuracy, each line contains a label."""
count = 0.0
match = 0.0
for label, pred in zip(references, predictions):
if label == pred:
match += 1
count += 1
return 100 * match / count
def word_accuracy(references, ... | 31.6 | 63 | 0.579747 |
8d58b29ff8551227e0820a24a80b4dff2e606808 | 48,392 | py | Python | sdk/storage/azure-storage-file-share/tests/test_share.py | chhtw/azure-sdk-for-python | 51c5ade919cb946fbe66faf6e4119b2e528331d4 | [
"MIT"
] | null | null | null | sdk/storage/azure-storage-file-share/tests/test_share.py | chhtw/azure-sdk-for-python | 51c5ade919cb946fbe66faf6e4119b2e528331d4 | [
"MIT"
] | null | null | null | sdk/storage/azure-storage-file-share/tests/test_share.py | chhtw/azure-sdk-for-python | 51c5ade919cb946fbe66faf6e4119b2e528331d4 | [
"MIT"
] | null | null | null | # coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------... | 37.80625 | 183 | 0.680174 |
b75490c5aeef981a36d32cac87599a542b550b99 | 20 | py | Python | tests/__init__.py | nicolas-f/noisesensor | fc007fe5e03b0deca0863d987cb6776be1cd2bef | [
"BSD-3-Clause"
] | 2 | 2020-03-29T21:58:45.000Z | 2021-09-21T12:43:15.000Z | tests/__init__.py | nicolas-f/noisesensor | fc007fe5e03b0deca0863d987cb6776be1cd2bef | [
"BSD-3-Clause"
] | null | null | null | tests/__init__.py | nicolas-f/noisesensor | fc007fe5e03b0deca0863d987cb6776be1cd2bef | [
"BSD-3-Clause"
] | 1 | 2019-02-19T14:53:01.000Z | 2019-02-19T14:53:01.000Z | import test_noisepy
| 10 | 19 | 0.9 |
defe1dac46625d7e611872fee52147eb750ce91e | 8,477 | py | Python | lib/reportlab/lib/textsplit.py | jwheare/digest | 963a0f46862319aa499d4cbbfdbd6380287fc5a5 | [
"BSD-3-Clause"
] | 5 | 2016-05-08T23:51:38.000Z | 2021-05-02T10:09:29.000Z | lib/reportlab/lib/textsplit.py | jwheare/digest | 963a0f46862319aa499d4cbbfdbd6380287fc5a5 | [
"BSD-3-Clause"
] | null | null | null | lib/reportlab/lib/textsplit.py | jwheare/digest | 963a0f46862319aa499d4cbbfdbd6380287fc5a5 | [
"BSD-3-Clause"
] | 1 | 2018-01-16T16:03:44.000Z | 2018-01-16T16:03:44.000Z | #Copyright ReportLab Europe Ltd. 2000-2006
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/textsplit.py
"""Helpers for text wrapping, hyphenation, Asian text splitting and kinsoku shori.
How to split a 'big word' depends on the la... | 41.553922 | 106 | 0.635012 |
87db260441ed7e615f0c65185e195febb06676b2 | 22,929 | py | Python | release/nightly_tests/dataset/ray_sgd_training.py | iamhatesz/ray | ce78d6b9495bd71cb16117032793ae9f133efb68 | [
"Apache-2.0"
] | 1 | 2021-07-12T11:16:14.000Z | 2021-07-12T11:16:14.000Z | release/nightly_tests/dataset/ray_sgd_training.py | RomaKoks/ray | 4ef0d4a37a42c529af98b0cfb31e505b51088395 | [
"Apache-2.0"
] | 115 | 2021-01-19T04:40:50.000Z | 2022-03-26T07:09:00.000Z | release/nightly_tests/dataset/ray_sgd_training.py | RomaKoks/ray | 4ef0d4a37a42c529af98b0cfb31e505b51088395 | [
"Apache-2.0"
] | null | null | null | import argparse
import collections
import json
import os
import sys
import time
from typing import Tuple
import boto3
import mlflow
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn.parallel import DistributedDataParallel
import ray
from ray import train
from ray.data.ag... | 34.846505 | 79 | 0.620001 |
3e1e7f1c296ecbff3c161b23a9857f58430d6dcb | 627 | py | Python | tests/test_extract_title.py | ssklyg36/mdut | 98874be1ea422e23fbb61e46c205718afd026cbf | [
"MIT"
] | 1 | 2022-01-09T18:06:09.000Z | 2022-01-09T18:06:09.000Z | tests/test_extract_title.py | ssklyg36/mdut | 98874be1ea422e23fbb61e46c205718afd026cbf | [
"MIT"
] | null | null | null | tests/test_extract_title.py | ssklyg36/mdut | 98874be1ea422e23fbb61e46c205718afd026cbf | [
"MIT"
] | null | null | null | import pytest
from mdut.mdut import extract_title
@pytest.mark.parametrize(
"html,title",
[
("<html><head><title>foo</title></head></html>", "foo"),
("<html><head><title>bar</title>", "bar"),
("<html><head><title>baz</head></html>", "baz"),
],
)
def test_valid(html, title):
as... | 19.59375 | 64 | 0.526316 |
119b935c0ca101aacb6558c8f0f847d0a3ae1b5a | 942 | py | Python | estrategias/e_Edu.py | lucasmoschen/jogos_vorazes | a483d901a32e95acb9fa17fca0f72c743122992c | [
"MIT"
] | 1 | 2021-01-29T05:20:25.000Z | 2021-01-29T05:20:25.000Z | estrategias/e_Edu.py | lucasmoschen/jogos_vorazes | a483d901a32e95acb9fa17fca0f72c743122992c | [
"MIT"
] | null | null | null | estrategias/e_Edu.py | lucasmoschen/jogos_vorazes | a483d901a32e95acb9fa17fca0f72c743122992c | [
"MIT"
] | 19 | 2016-01-15T17:24:45.000Z | 2021-01-28T18:12:50.000Z | __author__ = 'Bruno Almeida'
from random import choice
from estrategias.jogadores import Jogador
class MeuJogador(Jogador):
def __init__(self):
self.rodada_par = False
def escolha_de_cacada(self, rodada, comida_atual, reputacao_atual, m, reputacoes_dos_jogadores):
if ro... | 28.545455 | 100 | 0.576433 |
83e134606e3f06152ba22c612838add25c2dc337 | 3,246 | py | Python | tests/integration/helpers/http_server.py | torilov/ClickHouse | bbbe51033dfd5b8c3d54e168475ca707ac7ec0b4 | [
"Apache-2.0"
] | 1 | 2020-10-01T01:54:37.000Z | 2020-10-01T01:54:37.000Z | tests/integration/helpers/http_server.py | torilov/ClickHouse | bbbe51033dfd5b8c3d54e168475ca707ac7ec0b4 | [
"Apache-2.0"
] | null | null | null | tests/integration/helpers/http_server.py | torilov/ClickHouse | bbbe51033dfd5b8c3d54e168475ca707ac7ec0b4 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import argparse
import csv
import socket
import ssl
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
# Decorator used to see if authentication works for external dictionary who use a HTTP source.
def check_auth(fn):
def wrapper(req):
auth_header = req.headers.get('auth... | 36.886364 | 106 | 0.610906 |
e547c2df21e84b0a7ba4a6de2399e683209a4b03 | 5,229 | py | Python | doc/source/code/tut7.py | andaole/netpyne | 9ff475ff722fa8901d39008fab89d020e357b9ef | [
"MIT"
] | null | null | null | doc/source/code/tut7.py | andaole/netpyne | 9ff475ff722fa8901d39008fab89d020e357b9ef | [
"MIT"
] | null | null | null | doc/source/code/tut7.py | andaole/netpyne | 9ff475ff722fa8901d39008fab89d020e357b9ef | [
"MIT"
] | null | null | null | """
params.py
netParams is a dict containing a set of network parameters using a standardized structure
simConfig is a dict containing a set of simulation configurations using a standardized structure
Contributors: salvadordura@gmail.com
"""
from netpyne import specs
##############################################... | 44.313559 | 128 | 0.560337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.