hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | 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 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | 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 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | 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 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f71c8a133ef8994968d105d86d6a4f81b0c891b8 | 3,888 | py | Python | examples/python_service/pyservice.py | laungcisin/skein | 7f023239dcdee1482774466032bd63468cc7e42f | [
"BSD-3-Clause"
] | 124 | 2018-04-21T23:26:57.000Z | 2022-01-24T14:34:26.000Z | examples/python_service/pyservice.py | laungcisin/skein | 7f023239dcdee1482774466032bd63468cc7e42f | [
"BSD-3-Clause"
] | 144 | 2018-05-21T13:57:01.000Z | 2022-03-31T13:07:42.000Z | examples/python_service/pyservice.py | laungcisin/skein | 7f023239dcdee1482774466032bd63468cc7e42f | [
"BSD-3-Clause"
] | 36 | 2018-07-01T19:09:42.000Z | 2022-03-31T16:04:47.000Z | import argparse
import os
import tempfile
from getpass import getuser
import skein
from skein.tornado import SimpleAuthMixin, KerberosAuthMixin, init_kerberos
from tornado import web, ioloop
# An argument parser for configuring the application
parser = argparse.ArgumentParser(
description="A web service for subm... | 31.868852 | 80 | 0.626286 | import argparse
import os
import tempfile
from getpass import getuser
import skein
from skein.tornado import SimpleAuthMixin, KerberosAuthMixin, init_kerberos
from tornado import web, ioloop
parser = argparse.ArgumentParser(
description="A web service for submitting python scripts to YARN."
)
parser.add_argumen... | true | true |
f71c8b37ee651e199c6b02d5bd122d3d43661a14 | 2,874 | py | Python | scripts/product.py | etherisc/gif-contracts | 9bc09787a19bd79a0576e46856405cff7fdee15c | [
"Apache-2.0"
] | null | null | null | scripts/product.py | etherisc/gif-contracts | 9bc09787a19bd79a0576e46856405cff7fdee15c | [
"Apache-2.0"
] | null | null | null | scripts/product.py | etherisc/gif-contracts | 9bc09787a19bd79a0576e46856405cff7fdee15c | [
"Apache-2.0"
] | null | null | null | from web3 import Web3
from brownie import Contract
from brownie.convert import to_bytes
from brownie.network import accounts
from brownie.network.account import Account
from brownie import (
Wei,
Contract,
# Registry,
# RegistryController,
License,
LicenseController,
Policy,... | 27.113208 | 93 | 0.641267 | from web3 import Web3
from brownie import Contract
from brownie.convert import to_bytes
from brownie.network import accounts
from brownie.network.account import Account
from brownie import (
Wei,
Contract,
License,
LicenseController,
Policy,
PolicyController,
Query... | true | true |
f71c8bb35951957eb8062c9ab9ba757124ceaade | 1,056 | py | Python | database/creds.py | LaudateCorpus1/n-view | 8f474e40344c9a48e1d6ad43a4cfcb7de641219c | [
"Apache-2.0"
] | null | null | null | database/creds.py | LaudateCorpus1/n-view | 8f474e40344c9a48e1d6ad43a4cfcb7de641219c | [
"Apache-2.0"
] | null | null | null | database/creds.py | LaudateCorpus1/n-view | 8f474e40344c9a48e1d6ad43a4cfcb7de641219c | [
"Apache-2.0"
] | null | null | null | # (C) Copyright 2019 Hewlett Packard Enterprise Development LP.
# 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 ... | 35.2 | 74 | 0.749053 |
from mongoengine import signals
from application import db
class Creds(db.Document):
hostip = db.StringField(db_field="h", required=True)
username= db.StringField(db_field="u", required=True)
password = db.StringField(db_field="p", required=True)
| true | true |
f71c8c2ec884cd59a6a4294250c173594ed45b44 | 2,351 | py | Python | bin/ssa-end-to-end-testing/modules/github_service.py | adriaandens/security_content | f1f2f8370ce0f0986804ea9f89555de307a49d66 | [
"Apache-2.0"
] | 1 | 2021-06-17T05:23:19.000Z | 2021-06-17T05:23:19.000Z | bin/ssa-end-to-end-testing/modules/github_service.py | adriaandens/security_content | f1f2f8370ce0f0986804ea9f89555de307a49d66 | [
"Apache-2.0"
] | null | null | null | bin/ssa-end-to-end-testing/modules/github_service.py | adriaandens/security_content | f1f2f8370ce0f0986804ea9f89555de307a49d66 | [
"Apache-2.0"
] | null | null | null |
import git
import os
import logging
import glob
# Logger
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
LOGGER = logging.getLogger(__name__)
SECURITY_CONTENT_URL = "https://github.com/splunk/security_content"
class GithubService:
def __init__(self, security_content_branch):
self.securi... | 36.169231 | 114 | 0.632071 |
import git
import os
import logging
import glob
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
LOGGER = logging.getLogger(__name__)
SECURITY_CONTENT_URL = "https://github.com/splunk/security_content"
class GithubService:
def __init__(self, security_content_branch):
self.security_conte... | true | true |
f71c8ce9b3d8ee3617835b4bd38ad01e0b6f17d2 | 2,725 | py | Python | gumpy/split.py | gumpy-bci/gumpy | abd8230dc50bd8b0a2348c6e08a1bba1c0ed3146 | [
"MIT"
] | 55 | 2018-02-20T14:17:06.000Z | 2022-03-22T06:33:31.000Z | gumpy/gumpy/split.py | Tizzio/gumpy-project | c51ee75ddf1eaa58813b493282014da6f31f5591 | [
"MIT"
] | 5 | 2018-02-17T06:54:55.000Z | 2019-07-16T15:18:25.000Z | gumpy/gumpy/split.py | Tizzio/gumpy-project | c51ee75ddf1eaa58813b493282014da6f31f5591 | [
"MIT"
] | 23 | 2018-02-17T06:45:56.000Z | 2022-03-04T06:01:07.000Z | import sklearn.model_selection
import numpy as np
from sklearn.model_selection import ShuffleSplit, StratifiedShuffleSplit, cross_val_score, StratifiedKFold
def normal(X, labels, test_size):
"""Split a dataset into training and test parts.
Args:
X (numpy.ndarray): 2D features matrix
labels: ... | 36.333333 | 119 | 0.693945 | import sklearn.model_selection
import numpy as np
from sklearn.model_selection import ShuffleSplit, StratifiedShuffleSplit, cross_val_score, StratifiedKFold
def normal(X, labels, test_size):
Y = labels
X_train, X_test, Y_train, Y_test = \
sklearn.model_selection.train_test_split(X, Y,
... | true | true |
f71c8d37ae326e29cdf957282fbbe1c51cf54ac4 | 1,004 | py | Python | src/slack.py | villoro/airflow_tasks | 81bd892744a9bbbf6e01903649b6c3786a955a5a | [
"MIT"
] | null | null | null | src/slack.py | villoro/airflow_tasks | 81bd892744a9bbbf6e01903649b6c3786a955a5a | [
"MIT"
] | 4 | 2020-10-09T15:59:09.000Z | 2020-11-18T08:34:44.000Z | src/slack.py | villoro/airflow_tasks | 81bd892744a9bbbf6e01903649b6c3786a955a5a | [
"MIT"
] | null | null | null | import json
import requests
from utils import get_secret
from utils import is_pro
def send_slack(text="", channel="test", blocks=None):
assert channel in ["test", "events", "general"]
webhook = get_secret(f"SLACK_WEBHOOK_{channel.upper()}")
data = {"text": text}
if blocks:
data["blocks"] ... | 21.361702 | 84 | 0.644422 | import json
import requests
from utils import get_secret
from utils import is_pro
def send_slack(text="", channel="test", blocks=None):
assert channel in ["test", "events", "general"]
webhook = get_secret(f"SLACK_WEBHOOK_{channel.upper()}")
data = {"text": text}
if blocks:
data["blocks"] ... | true | true |
f71c8d87b4e0910142ebc974a5c242cbc32868ab | 798 | py | Python | tree/b_my_solution.py | master-cim/algorithm | a57f473ceb32b96240989e31ac33154e55c00724 | [
"MIT"
] | 1 | 2022-03-31T07:30:53.000Z | 2022-03-31T07:30:53.000Z | tree/b_my_solution.py | master-cim/algorithm | a57f473ceb32b96240989e31ac33154e55c00724 | [
"MIT"
] | null | null | null | tree/b_my_solution.py | master-cim/algorithm | a57f473ceb32b96240989e31ac33154e55c00724 | [
"MIT"
] | 2 | 2022-03-04T09:42:03.000Z | 2022-03-30T14:51:32.000Z | # B. Сбалансированное дерево
# ID успешной посылки 66593272
class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.right = right
self.left = left
def height(root):
if root is None:
return 0
return max(height(root.left), height(root.right)) ... | 21.567568 | 57 | 0.616541 |
class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.right = right
self.left = left
def height(root):
if root is None:
return 0
return max(height(root.left), height(root.right)) + 1
def solution(root):
if root is None:
retu... | true | true |
f71c8d946e5ae29a441cb944deb2a30473a80d7d | 21,205 | py | Python | py/desispec/scripts/stdstars.py | segasai/desispec | 4786347a8ad44effa4985671423f7ba0129ba6c3 | [
"BSD-3-Clause"
] | null | null | null | py/desispec/scripts/stdstars.py | segasai/desispec | 4786347a8ad44effa4985671423f7ba0129ba6c3 | [
"BSD-3-Clause"
] | null | null | null | py/desispec/scripts/stdstars.py | segasai/desispec | 4786347a8ad44effa4985671423f7ba0129ba6c3 | [
"BSD-3-Clause"
] | null | null | null |
"""
Get the normalized best template to do flux calibration.
"""
#- TODO: refactor algorithmic code into a separate module/function
import argparse
import sys
import numpy as np
from astropy.io import fits
from astropy import units
from astropy.table import Table
from desispec import io
from desispec.fluxcalibrat... | 43.01217 | 175 | 0.614902 |
import argparse
import sys
import numpy as np
from astropy.io import fits
from astropy import units
from astropy.table import Table
from desispec import io
from desispec.fluxcalibration import match_templates,normalize_templates,isStdStar
from desispec.interpolation import resample_flux
from desiutil.log import ... | true | true |
f71c8ece5ac79d8215cf3897a8f8aec003849358 | 33,179 | py | Python | ros/src/tl_detector/light_classification/protos/box_predictor_pb2.py | allaydesai/SDCND_system_integration | 078c1f77ea0c5f09af42f7974d9b49a4000f10d7 | [
"MIT"
] | 13 | 2020-03-04T10:16:28.000Z | 2022-01-06T11:14:29.000Z | ros/src/tl_detector/light_classification/protos/box_predictor_pb2.py | allaydesai/SDCND_system_integration | 078c1f77ea0c5f09af42f7974d9b49a4000f10d7 | [
"MIT"
] | 5 | 2020-01-28T23:04:54.000Z | 2022-02-10T00:23:36.000Z | ros/src/tl_detector/light_classification/protos/box_predictor_pb2.py | allaydesai/SDCND_system_integration | 078c1f77ea0c5f09af42f7974d9b49a4000f10d7 | [
"MIT"
] | 6 | 2019-10-22T12:43:40.000Z | 2021-09-18T08:10:31.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: object_detection/protos/box_predictor.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protob... | 53.0864 | 3,991 | 0.777811 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google... | true | true |
f71c8eebfa69486d737645f22b74bf824a91eeee | 1,479 | py | Python | beerxml/picobrew_parser.py | rryanburton/PicobrewServerDjango | 24e616677a8543638204889bfe19062b9d16c7ae | [
"MIT"
] | 5 | 2017-07-25T04:32:47.000Z | 2020-10-10T14:27:16.000Z | beerxml/picobrew_parser.py | rryanburton/PicobrewServerDjango | 24e616677a8543638204889bfe19062b9d16c7ae | [
"MIT"
] | 3 | 2020-02-11T23:53:22.000Z | 2021-06-10T19:29:52.000Z | beerxml/picobrew_parser.py | rryanburton/PicobrewServerDjango | 24e616677a8543638204889bfe19062b9d16c7ae | [
"MIT"
] | 1 | 2018-12-23T08:57:34.000Z | 2018-12-23T08:57:34.000Z | from pybeerxml.parser import Parser
from .picobrew_recipe import PicoBrewRecipe
from .picobrew_program_step import PicoBrewProgramStep
from xml.etree import ElementTree
class PicoBrewParser(Parser):
def parse(self, xml_file):
# Parse the BeerXML file
recipes = super(PicoBrewParser, self).parse(xm... | 29.58 | 75 | 0.610548 | from pybeerxml.parser import Parser
from .picobrew_recipe import PicoBrewRecipe
from .picobrew_program_step import PicoBrewProgramStep
from xml.etree import ElementTree
class PicoBrewParser(Parser):
def parse(self, xml_file):
recipes = super(PicoBrewParser, self).parse(xml_file)
... | true | true |
f71c8f6aa2a62ab271f35e5e3080e58ef457c6cb | 782 | py | Python | examples/kmeansHeightWeight.py | Duane321/pyprobml | 6d0ba29f22dc7fec9dfc73788bc5520e97663bdb | [
"MIT"
] | null | null | null | examples/kmeansHeightWeight.py | Duane321/pyprobml | 6d0ba29f22dc7fec9dfc73788bc5520e97663bdb | [
"MIT"
] | null | null | null | examples/kmeansHeightWeight.py | Duane321/pyprobml | 6d0ba29f22dc7fec9dfc73788bc5520e97663bdb | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import matplotlib.pyplot as pl
import numpy as np
from utils import util
from sklearn.cluster import KMeans
from utils.util import save_fig
data = util.load_mat('heightWeight/heightWeight')
data = data['heightWeightData']
markers = 'Dox'
colors = 'rgb'
for i in range(3):
KM_model = KMeans(i... | 28.962963 | 56 | 0.644501 |
import matplotlib.pyplot as pl
import numpy as np
from utils import util
from sklearn.cluster import KMeans
from utils.util import save_fig
data = util.load_mat('heightWeight/heightWeight')
data = data['heightWeightData']
markers = 'Dox'
colors = 'rgb'
for i in range(3):
KM_model = KMeans(init='k-means++', n_cl... | true | true |
f71c8fc259c0697f53a0ebace9290263e205e66d | 2,867 | py | Python | testsuite/N806.py | ramnes/pep8-naming | 9d2004fcd28d2434bcceeed843cd353a2e8808e2 | [
"MIT"
] | null | null | null | testsuite/N806.py | ramnes/pep8-naming | 9d2004fcd28d2434bcceeed843cd353a2e8808e2 | [
"MIT"
] | null | null | null | testsuite/N806.py | ramnes/pep8-naming | 9d2004fcd28d2434bcceeed843cd353a2e8808e2 | [
"MIT"
] | null | null | null | #: Okay
def test():
good = 1
#: Okay
def test():
def test2():
good = 1
#: Okay
GOOD = 1
#: Okay
class Test(object):
GOOD = 1
#: N806
def test():
Bad = 1
#: N806
def test():
VERY = 2
#: N806
def test():
def test2():
class Foo(object):
def test3(self):
B... | 16.668605 | 79 | 0.536798 |
def test():
good = 1
def test():
def test2():
good = 1
GOOD = 1
class Test(object):
GOOD = 1
def test():
Bad = 1
def test():
VERY = 2
def test():
def test2():
class Foo(object):
def test3(self):
Bad = 3
def test():
Bad = 1
def good():
... | true | true |
f71c91a3f54d9b713dc013f6441b683eae4ab3e6 | 6,683 | py | Python | graphnas_variants/micro_graphnas/micro_search_space.py | mhnnunes/nas_gnn | 91092acfee9fdbbef3e22252040b80aa96143311 | [
"Apache-2.0"
] | 13 | 2020-07-29T12:45:22.000Z | 2022-03-07T06:26:02.000Z | graphnas_variants/micro_graphnas/micro_search_space.py | mhnnunes/nas_gnn | 91092acfee9fdbbef3e22252040b80aa96143311 | [
"Apache-2.0"
] | null | null | null | graphnas_variants/micro_graphnas/micro_search_space.py | mhnnunes/nas_gnn | 91092acfee9fdbbef3e22252040b80aa96143311 | [
"Apache-2.0"
] | 3 | 2020-09-27T06:43:17.000Z | 2020-11-26T08:43:35.000Z | import torch
import torch.nn.functional as F
from torch.nn import Module
from torch_geometric.nn.conv import *
gnn_list = [
"gat_8", # GAT with 8 heads
"gat_6", # GAT with 6 heads
"gat_4", # GAT with 4 heads
"gat_2", # GAT with 2 heads
"gat_1", # GAT with 1 heads
"gcn", # GCN
"cheb", ... | 34.448454 | 79 | 0.5511 | import torch
import torch.nn.functional as F
from torch.nn import Module
from torch_geometric.nn.conv import *
gnn_list = [
"gat_8",
"gat_6",
"gat_4",
"gat_2",
"gat_1",
"gcn",
"cheb",
"sage",
"arma",
"sg",
"linear",
"zero",
]
act_list = [
... | true | true |
f71c93ab4c1c3f762719bbced5d27f4ff685c6fe | 25,712 | py | Python | ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py | runningt/ambari | 7b91469e68a80bfcabe4b79d855caa684bf51378 | [
"Apache-2.0"
] | null | null | null | ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py | runningt/ambari | 7b91469e68a80bfcabe4b79d855caa684bf51378 | [
"Apache-2.0"
] | null | null | null | ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py | runningt/ambari | 7b91469e68a80bfcabe4b79d855caa684bf51378 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
'''
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")... | 43.14094 | 153 | 0.552427 |
'''
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 thi... | false | true |
f71c945e6058577857c0b8a5868cd8a7b234044b | 2,412 | py | Python | jupyter_server_mathjax/app.py | minrk/jupyter_server_mathjax | 4dfbcf70ee00de3776cd2acf1debdc790e56f64e | [
"BSD-3-Clause"
] | null | null | null | jupyter_server_mathjax/app.py | minrk/jupyter_server_mathjax | 4dfbcf70ee00de3776cd2acf1debdc790e56f64e | [
"BSD-3-Clause"
] | null | null | null | jupyter_server_mathjax/app.py | minrk/jupyter_server_mathjax | 4dfbcf70ee00de3776cd2acf1debdc790e56f64e | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from pathlib import Path
from traitlets import default, observe, Unicode
from tornado.web import RedirectHandler
from jupyter_server.extension.application import ExtensionApp
from jupyter_server.utils import url_path... | 31.736842 | 105 | 0.625622 |
from pathlib import Path
from traitlets import default, observe, Unicode
from tornado.web import RedirectHandler
from jupyter_server.extension.application import ExtensionApp
from jupyter_server.utils import url_path_join
from jupyter_server.transutils import _
STATIC_ASSETS_PATH = Path(__file__).parent / "stati... | true | true |
f71c94ef510848605c979ad6aae3be1a96a86bcd | 5,538 | py | Python | src/movies/management/commands/add_kp_movie.py | Little-Pogchamp-Team/kinopoisk_on_django | 06e1b5ee14c7e77dd5b69140732461a02bf44566 | [
"MIT"
] | 10 | 2021-01-10T09:39:16.000Z | 2022-02-05T06:40:47.000Z | src/movies/management/commands/add_kp_movie.py | Little-Pogchamp-Team/kinopoisk_on_django | 06e1b5ee14c7e77dd5b69140732461a02bf44566 | [
"MIT"
] | null | null | null | src/movies/management/commands/add_kp_movie.py | Little-Pogchamp-Team/kinopoisk_on_django | 06e1b5ee14c7e77dd5b69140732461a02bf44566 | [
"MIT"
] | 1 | 2021-01-11T17:04:06.000Z | 2021-01-11T17:04:06.000Z | import asyncio
import os
from datetime import date
from os import getenv
from django.core.files.images import ImageFile
from django.core.management.base import BaseCommand
from movies.models import Poster, Movie, Genre
from person.models import Person, Photo, PersonRole
from parser.formatter import get_formatted_movie... | 43.606299 | 120 | 0.639581 | import asyncio
import os
from datetime import date
from os import getenv
from django.core.files.images import ImageFile
from django.core.management.base import BaseCommand
from movies.models import Poster, Movie, Genre
from person.models import Person, Photo, PersonRole
from parser.formatter import get_formatted_movie... | true | true |
f71c9666f42e0445cb30a86089bfe762d8443e53 | 1,292 | py | Python | archspee/presenters/log.py | wangpy/archspee | 97855f903106fba567ffda8cdc25b061cd8bdf5e | [
"MIT"
] | 8 | 2019-01-22T13:03:40.000Z | 2021-12-30T22:11:12.000Z | archspee/presenters/log.py | wangpy/archspee | 97855f903106fba567ffda8cdc25b061cd8bdf5e | [
"MIT"
] | null | null | null | archspee/presenters/log.py | wangpy/archspee | 97855f903106fba567ffda8cdc25b061cd8bdf5e | [
"MIT"
] | null | null | null | from archspee.presenters import PresenterBase
from archspee.listeners import ListenerStatus
_LOG_LEVEL = None
class LogPresenter(PresenterBase):
def __init__(self, action_callback, **kwargs):
self.__log_level = _LOG_LEVEL
super(LogPresenter, self).__init__(action_callback)
self.status = Li... | 39.151515 | 100 | 0.687307 | from archspee.presenters import PresenterBase
from archspee.listeners import ListenerStatus
_LOG_LEVEL = None
class LogPresenter(PresenterBase):
def __init__(self, action_callback, **kwargs):
self.__log_level = _LOG_LEVEL
super(LogPresenter, self).__init__(action_callback)
self.status = Li... | true | true |
f71c96af05ee8e95f66b314c7abe60dd75cb2846 | 14,146 | py | Python | python/oneflow/nn/optimizer/optimizer.py | butterluo/oneflow | cf2ce575d80f89642b71bee2248e69b09213007d | [
"Apache-2.0"
] | null | null | null | python/oneflow/nn/optimizer/optimizer.py | butterluo/oneflow | cf2ce575d80f89642b71bee2248e69b09213007d | [
"Apache-2.0"
] | null | null | null | python/oneflow/nn/optimizer/optimizer.py | butterluo/oneflow | cf2ce575d80f89642b71bee2248e69b09213007d | [
"Apache-2.0"
] | null | null | null | """
Copyright 2020 The OneFlow 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 applicable law or agr... | 38.336043 | 148 | 0.600028 | import collections
import warnings
from copy import deepcopy
from itertools import chain
from typing import Any, Callable, Dict, Union
from oneflow.framework.tensor import Tensor
from oneflow.nn.graph.block import TensorBlock
from oneflow.nn.parameter import Parameter
from oneflow.nn.utils.clip_grad import clip_grad_n... | true | true |
f71c971bf4dd805103974078d53aae515b91c0a1 | 1,361 | py | Python | petastorm/cache.py | cclauss/petastorm | 12fc6542005c6dc7c99997604b939536cca79fa9 | [
"Apache-2.0"
] | 1 | 2018-09-25T10:59:29.000Z | 2018-09-25T10:59:29.000Z | petastorm/cache.py | cclauss/petastorm | 12fc6542005c6dc7c99997604b939536cca79fa9 | [
"Apache-2.0"
] | null | null | null | petastorm/cache.py | cclauss/petastorm | 12fc6542005c6dc7c99997604b939536cca79fa9 | [
"Apache-2.0"
] | 1 | 2018-09-25T10:59:32.000Z | 2018-09-25T10:59:32.000Z | # Copyright (c) 2017-2018 Uber Technologies, 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 ... | 33.195122 | 112 | 0.709772 |
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class CacheBase(object):
@abc.abstractmethod
def get(self, key, fill_cache_func):
pass
class NullCache(CacheBase):
def get(self, key, fill_cache_func):
return fill_cache_func()
| true | true |
f71c98221a39db59c80de17a016146f0be85cd00 | 6,266 | py | Python | nicos_mlz/mira/devices/stargate.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | null | null | null | nicos_mlz/mira/devices/stargate.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | null | null | null | nicos_mlz/mira/devices/stargate.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | null | null | null | # -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | 34.811111 | 79 | 0.608682 |
from time import monotonic
from nicos.core import SIMULATION, Attach, InvalidValueError, Param, listof, \
status
from nicos.devices import entangle
from nicos_mlz.mira.devices.axis import HoveringAxis
class Stargate(entangle.DigitalOutput):
valuetype = listof(int)
parameters =... | true | true |
f71c98c738d67bea14753699412d0bb3f45ce1c4 | 237 | py | Python | jina/types/arrays/__init__.py | slettner/jina | 4140961c62359e3acd540a6d88931665c6313824 | [
"Apache-2.0"
] | null | null | null | jina/types/arrays/__init__.py | slettner/jina | 4140961c62359e3acd540a6d88931665c6313824 | [
"Apache-2.0"
] | null | null | null | jina/types/arrays/__init__.py | slettner/jina | 4140961c62359e3acd540a6d88931665c6313824 | [
"Apache-2.0"
] | null | null | null | __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from .document import DocumentArray
from .querylang import QueryLangArray
from .chunk import ChunkArray
from .match import MatchArray
| 29.625 | 74 | 0.801688 | __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from .document import DocumentArray
from .querylang import QueryLangArray
from .chunk import ChunkArray
from .match import MatchArray
| true | true |
f71c9a76519602baf175d90363655dc76c65ea28 | 512 | py | Python | MobileRevelator/python/postbank_finanzassistent_decrypt.py | ohunecker/MR | b0c93436c7964d87a0b8154f8b7662b1731124b9 | [
"MIT"
] | 98 | 2019-02-03T22:50:24.000Z | 2022-03-17T12:50:56.000Z | MobileRevelator/python/postbank_finanzassistent_decrypt.py | cewatkins/MR | 5ba553fd0eb4c1d80842074a553119486f005822 | [
"MIT"
] | 10 | 2019-03-14T20:12:10.000Z | 2020-05-23T10:37:54.000Z | MobileRevelator/python/postbank_finanzassistent_decrypt.py | cewatkins/MR | 5ba553fd0eb4c1d80842074a553119486f005822 | [
"MIT"
] | 30 | 2019-02-03T22:50:27.000Z | 2022-03-30T12:37:30.000Z | #Filename="finanzassistent"
#Type=Prerun
import os
def main():
ctx.gui_setMainLabel("Postbank Finanzassistent: Extracting key");
error=""
dbkey="73839EC3A528910B235859947CC8424543D7B686"
ctx.gui_setMainLabel("Postbank: Key extracted: " + dbkey)
if not (ctx.fs_sqlcipher_decrypt(filename, ... | 34.133333 | 78 | 0.6875 |
import os
def main():
ctx.gui_setMainLabel("Postbank Finanzassistent: Extracting key");
error=""
dbkey="73839EC3A528910B235859947CC8424543D7B686"
ctx.gui_setMainLabel("Postbank: Key extracted: " + dbkey)
if not (ctx.fs_sqlcipher_decrypt(filename, filename + ".dec", dbkey)):
erro... | true | true |
f71c9ac104ae461bd523cc38b814d19111b44e47 | 1,166 | py | Python | google/ads/googleads/v10/enums/types/feed_item_target_device.py | JakobSteixner/google-ads-python | df2b802cc7e78295a4ece21cc7ef3787cd35dab0 | [
"Apache-2.0"
] | null | null | null | google/ads/googleads/v10/enums/types/feed_item_target_device.py | JakobSteixner/google-ads-python | df2b802cc7e78295a4ece21cc7ef3787cd35dab0 | [
"Apache-2.0"
] | null | null | null | google/ads/googleads/v10/enums/types/feed_item_target_device.py | JakobSteixner/google-ads-python | df2b802cc7e78295a4ece21cc7ef3787cd35dab0 | [
"Apache-2.0"
] | null | null | null | # -*- 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... | 29.15 | 74 | 0.716123 |
import proto
__protobuf__ = proto.module(
package="google.ads.googleads.v10.enums",
marshal="google.ads.googleads.v10",
manifest={"FeedItemTargetDeviceEnum",},
)
class FeedItemTargetDeviceEnum(proto.Message):
class FeedItemTargetDevice(proto.Enum):
UNSPECIFIED = 0
U... | true | true |
f71c9b79db447996719fed63c8fac35684923c7b | 3,915 | py | Python | nova/scheduler/ironic_host_manager.py | gabriel-samfira/nova | 5ef07cc04dbf0216452ae358e57d9ddac51f1803 | [
"Apache-2.0"
] | null | null | null | nova/scheduler/ironic_host_manager.py | gabriel-samfira/nova | 5ef07cc04dbf0216452ae358e57d9ddac51f1803 | [
"Apache-2.0"
] | null | null | null | nova/scheduler/ironic_host_manager.py | gabriel-samfira/nova | 5ef07cc04dbf0216452ae358e57d9ddac51f1803 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2012 NTT DOCOMO, INC.
# Copyright (c) 2011-2014 OpenStack Foundation
# 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.apa... | 38.382353 | 78 | 0.676373 |
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from nova.openstack.common import log as logging
import nova.scheduler.base_baremetal_host_manager as bbhm
from nova.scheduler import host_manager
host_manager_opts = [
cfg.ListOpt('baremetal_sche... | true | true |
f71c9c06c32c6896b3720e78b40f52d65c87972e | 2,059 | py | Python | keystone_reports.py | mheler/copystack | 11a30e1ca968208a96fa80f3afad8dc067342e44 | [
"Apache-2.0"
] | 4 | 2017-07-26T23:01:10.000Z | 2019-04-25T18:37:19.000Z | keystone_reports.py | mheler/copystack | 11a30e1ca968208a96fa80f3afad8dc067342e44 | [
"Apache-2.0"
] | 2 | 2017-11-02T10:50:04.000Z | 2021-12-13T19:43:54.000Z | keystone_reports.py | mheler/copystack | 11a30e1ca968208a96fa80f3afad8dc067342e44 | [
"Apache-2.0"
] | 6 | 2017-02-15T17:58:35.000Z | 2018-12-03T18:00:47.000Z | #!/usr/bin/env python
# Copyright (c) 2019 Rackspace US, 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 applica... | 37.436364 | 128 | 0.687227 |
import json
import argparse
import optparse
import keystone_common
import neutron_common
import nova_common
import glance_common
import cinder_common
from auth_stack2 import AuthStack
def main(opts, args):
auth = AuthStack()
print "From:", auth.from_auth_ip, " Username:", auth.from_username, "... | false | true |
f71c9cd673a863c06787408e99e849774b777b45 | 931 | py | Python | main.py | flatman123/device_auto_config_v0.0.1 | b6335e07735f937089c528130c4b50a6bd32641d | [
"MIT"
] | null | null | null | main.py | flatman123/device_auto_config_v0.0.1 | b6335e07735f937089c528130c4b50a6bd32641d | [
"MIT"
] | null | null | null | main.py | flatman123/device_auto_config_v0.0.1 | b6335e07735f937089c528130c4b50a6bd32641d | [
"MIT"
] | 1 | 2020-10-09T14:43:21.000Z | 2020-10-09T14:43:21.000Z | from decrypt_file import decrypt
from get_commands import fetch_commands
import netmiko
import os
import concurrent.futures
hosts = decrypt(f'{os.getcwd()}/device_json.gpg')
def send_commands(connection, host, commands):
connection.send_config_set(commands)
return
def run(ip_address):
for device in hosts... | 26.6 | 61 | 0.654135 | from decrypt_file import decrypt
from get_commands import fetch_commands
import netmiko
import os
import concurrent.futures
hosts = decrypt(f'{os.getcwd()}/device_json.gpg')
def send_commands(connection, host, commands):
connection.send_config_set(commands)
return
def run(ip_address):
for device in hosts... | true | true |
f71c9dde7d847171940268a4386ef04e1c81c1ea | 20,567 | py | Python | tmmPCECalc.py | NREL/PVwindow | df7091c9d1ebd280aca53c50015e3b1ee7a3183e | [
"BSD-2-Clause"
] | null | null | null | tmmPCECalc.py | NREL/PVwindow | df7091c9d1ebd280aca53c50015e3b1ee7a3183e | [
"BSD-2-Clause"
] | null | null | null | tmmPCECalc.py | NREL/PVwindow | df7091c9d1ebd280aca53c50015e3b1ee7a3183e | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 4 12:29:21 2021
@author: aduell
"""
#import numpy as np
from numpy import pi, linspace, array, exp
#import tmm
from tmm import inc_tmm, inc_absorp_in_each_layer, inf
#import pandas as pd
#import tmm_vw as tmm
#import matplotlib.pyplot as plt
from matplotlib.pyplot impo... | 37.876611 | 196 | 0.685516 |
from numpy import pi, linspace, array, exp
from tmm import inc_tmm, inc_absorp_in_each_layer, inf
from matplotlib.pyplot import plot,figure,xlabel,ylabel,show,ylim,legend
from wpv import Layer, Stack
from scipy.interpolate import interp1d
from scipy.integrate import quad, trapz
from scipy.optimize import fsolv... | true | true |
f71c9f822c037dcf590935a9d553531d88e41ced | 15,021 | py | Python | tests/parallel/topics/TestFiniteTopicModel.py | co2meal/-bnpy-dev | 74f69afde6c9dac8de4c074842df53ae87a15ac1 | [
"BSD-3-Clause"
] | null | null | null | tests/parallel/topics/TestFiniteTopicModel.py | co2meal/-bnpy-dev | 74f69afde6c9dac8de4c074842df53ae87a15ac1 | [
"BSD-3-Clause"
] | null | null | null | tests/parallel/topics/TestFiniteTopicModel.py | co2meal/-bnpy-dev | 74f69afde6c9dac8de4c074842df53ae87a15ac1 | [
"BSD-3-Clause"
] | null | null | null | """
Collection of functions and classes for testing a naive version
of parallel execution for topic model variational inference.
Usage
-----
From a shell/terminal, use like a standard Python script.
$ python TestFiniteTopicModel.py --N 200 --nDoc 500 --K 50 --nWorkers 2
For some keyword args (like N, nDoc, K, nWorker... | 32.868709 | 79 | 0.601092 | """
Collection of functions and classes for testing a naive version
of parallel execution for topic model variational inference.
Usage
-----
From a shell/terminal, use like a standard Python script.
$ python TestFiniteTopicModel.py --N 200 --nDoc 500 --K 50 --nWorkers 2
For some keyword args (like N, nDoc, K, nWorker... | false | true |
f71c9f9d367cb8155ed384c51b60c4ecac3f16c3 | 447 | py | Python | plan_marker/migrations/0003_auto_20150829_1529.py | oskgeek/tdl_fitness | e61da8b4b216147ba1e5d9b64db75f2cf8568759 | [
"Apache-2.0"
] | null | null | null | plan_marker/migrations/0003_auto_20150829_1529.py | oskgeek/tdl_fitness | e61da8b4b216147ba1e5d9b64db75f2cf8568759 | [
"Apache-2.0"
] | null | null | null | plan_marker/migrations/0003_auto_20150829_1529.py | oskgeek/tdl_fitness | e61da8b4b216147ba1e5d9b64db75f2cf8568759 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('plan_marker', '0002_userprofile_plan_created'),
]
operations = [
migrations.AlterField(
model_name='userprofile'... | 22.35 | 74 | 0.630872 |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('plan_marker', '0002_userprofile_plan_created'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='pla... | true | true |
f71ca0e23cd8fb822e78350418aeea8241322271 | 1,142 | py | Python | sequenceplot/__init__.py | kickingvegas/SequencePlot | 82514e0dc1a3e670ea727041219dc7a69fd9e96b | [
"Apache-2.0"
] | 3 | 2017-07-23T22:32:22.000Z | 2020-05-03T20:16:36.000Z | sequenceplot/__init__.py | kickingvegas/SequencePlot | 82514e0dc1a3e670ea727041219dc7a69fd9e96b | [
"Apache-2.0"
] | null | null | null | sequenceplot/__init__.py | kickingvegas/SequencePlot | 82514e0dc1a3e670ea727041219dc7a69fd9e96b | [
"Apache-2.0"
] | 1 | 2021-09-10T08:45:39.000Z | 2021-09-10T08:45:39.000Z | #!/usr/bin/env python
# Copyright 2012 Yummy Melon Software 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 appl... | 26.55814 | 89 | 0.738179 |
__version__ = '0.4'
class SyntaxError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def picEscapeString(buf):
result = buf.replace('"', '\\"')
return result
from SequenceObject import SequenceObject
from P... | true | true |
f71ca16a0d7d9c01229a650639558eb2857cf6b5 | 681 | py | Python | python/discord.py/example-bot.py | martian17/Community-Bin | e7a1471571227fdda3929a9cdd9a3cce743156df | [
"MIT"
] | null | null | null | python/discord.py/example-bot.py | martian17/Community-Bin | e7a1471571227fdda3929a9cdd9a3cce743156df | [
"MIT"
] | null | null | null | python/discord.py/example-bot.py | martian17/Community-Bin | e7a1471571227fdda3929a9cdd9a3cce743156df | [
"MIT"
] | null | null | null | # This is an example of a very basic discord bot in python
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=".", description="A basic discord bot")
@bot.event
async def on_ready():
print("I'm online!")
@commands.command(name="ping")
async def _ping(ctx):
latency = bot.late... | 23.482759 | 73 | 0.678414 |
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=".", description="A basic discord bot")
@bot.event
async def on_ready():
print("I'm online!")
@commands.command(name="ping")
async def _ping(ctx):
latency = bot.latency * 1000 # convert to ms
embed = discord.Embed(
... | true | true |
f71ca30466bc275ef559c5fc42e0c93a4703385c | 1,407 | py | Python | csvkit/convert/__init__.py | tthibo/csvkit | fb12c7df32504b51b9def6e3cff41c36147616cf | [
"MIT"
] | 2 | 2015-03-06T15:22:02.000Z | 2016-03-11T13:35:48.000Z | csvkit/convert/__init__.py | tthibo/csvkit | fb12c7df32504b51b9def6e3cff41c36147616cf | [
"MIT"
] | null | null | null | csvkit/convert/__init__.py | tthibo/csvkit | fb12c7df32504b51b9def6e3cff41c36147616cf | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from csvitself import csv2csv
from fixed import fixed2csv
from js import json2csv
from xls import xls2csv
SUPPORTED_FORMATS = ['fixed', 'xls', 'csv']
def convert(f, format, schema=None, key=None, **kwargs):
"""
Convert a file of a specified format to CSV.
"""
if not f:
r... | 25.125 | 78 | 0.606254 |
from csvitself import csv2csv
from fixed import fixed2csv
from js import json2csv
from xls import xls2csv
SUPPORTED_FORMATS = ['fixed', 'xls', 'csv']
def convert(f, format, schema=None, key=None, **kwargs):
if not f:
raise ValueError('f must not be None')
if not format:
raise ValueError('fo... | true | true |
f71ca381286ae5e3aa87acbe71537fe119e50954 | 4,491 | py | Python | demoNN.py | zelhar/mg21 | f8392aba7deb63aa85f3d137ef81dea1bb742b41 | [
"MIT"
] | null | null | null | demoNN.py | zelhar/mg21 | f8392aba7deb63aa85f3d137ef81dea1bb742b41 | [
"MIT"
] | null | null | null | demoNN.py | zelhar/mg21 | f8392aba7deb63aa85f3d137ef81dea1bb742b41 | [
"MIT"
] | null | null | null | import torch
from torch import nn
from torch.utils.data import DataLoader, Dataset, TensorDataset
from torchvision import datasets
from torchvision.transforms import ToTensor, Lambda, Compose
import matplotlib.pyplot as plt
import torch.distributions as D
import torch.nn.functional as F
# Download training data from... | 25.959538 | 91 | 0.649521 | import torch
from torch import nn
from torch.utils.data import DataLoader, Dataset, TensorDataset
from torchvision import datasets
from torchvision.transforms import ToTensor, Lambda, Compose
import matplotlib.pyplot as plt
import torch.distributions as D
import torch.nn.functional as F
training_data = datasets.Fas... | true | true |
f71ca389de2acdd4122644dc61a4fb411c6d4bf0 | 4,451 | py | Python | geoist/snoopy/algorithms/correlator_algorithms/cross_correlator.py | CHEN-Zhaohui/geoist | 06a00db3e0ed3d92abf3e45b7b3bfbef6a858a5b | [
"MIT"
] | 53 | 2018-11-17T03:29:55.000Z | 2022-03-18T02:36:25.000Z | geoist/snoopy/algorithms/correlator_algorithms/cross_correlator.py | CHEN-Zhaohui/geoist | 06a00db3e0ed3d92abf3e45b7b3bfbef6a858a5b | [
"MIT"
] | 3 | 2018-11-28T11:37:51.000Z | 2019-01-30T01:52:45.000Z | geoist/snoopy/algorithms/correlator_algorithms/cross_correlator.py | CHEN-Zhaohui/geoist | 06a00db3e0ed3d92abf3e45b7b3bfbef6a858a5b | [
"MIT"
] | 35 | 2018-11-17T03:29:57.000Z | 2022-03-23T17:57:06.000Z | # coding=utf-8
from geoist.snoopy.algorithms.correlator_algorithms import CorrelatorAlgorithm
from geoist.snoopy.modules.correlation_result import CorrelationResult
from geoist.snoopy.constants import (DEFAULT_SHIFT_IMPACT,
DEFAULT_ALLOWED_SHIFT_SECONDS)
class CrossCorrelator(Correlato... | 43.637255 | 128 | 0.642103 |
from geoist.snoopy.algorithms.correlator_algorithms import CorrelatorAlgorithm
from geoist.snoopy.modules.correlation_result import CorrelationResult
from geoist.snoopy.constants import (DEFAULT_SHIFT_IMPACT,
DEFAULT_ALLOWED_SHIFT_SECONDS)
class CrossCorrelator(CorrelatorAlgorithm):
... | true | true |
f71ca44defb36643ad8a93f4726f956b8b913e57 | 346 | py | Python | Algorithms/746/min-cost-climbing-stairs.py | M-Quadra/LeetCode-problems | 0cc100aa1e50b02df289f04fe2e0b97239eb9895 | [
"MIT"
] | null | null | null | Algorithms/746/min-cost-climbing-stairs.py | M-Quadra/LeetCode-problems | 0cc100aa1e50b02df289f04fe2e0b97239eb9895 | [
"MIT"
] | null | null | null | Algorithms/746/min-cost-climbing-stairs.py | M-Quadra/LeetCode-problems | 0cc100aa1e50b02df289f04fe2e0b97239eb9895 | [
"MIT"
] | null | null | null | from typing import List
class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
dp = [0x7FFFFFFF for _ in range(len(cost)+2)]
dp[0] = dp[1] = 0
for i, v in enumerate(cost):
v += dp[i]
dp[i+1] = min(dp[i+1], v)
dp[i+2] = min(dp[i+2], v)
... | 31.454545 | 60 | 0.508671 | from typing import List
class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
dp = [0x7FFFFFFF for _ in range(len(cost)+2)]
dp[0] = dp[1] = 0
for i, v in enumerate(cost):
v += dp[i]
dp[i+1] = min(dp[i+1], v)
dp[i+2] = min(dp[i+2], v)
... | true | true |
f71ca45c2a4d1c7deaea184b4a83e5e006c32425 | 90 | py | Python | regtests/str/mul.py | bpmbank/PythonJS | 591a80afd8233fb715493591db2b68f1748558d9 | [
"BSD-3-Clause"
] | 319 | 2015-01-02T11:34:16.000Z | 2022-03-25T00:43:33.000Z | regtests/str/mul.py | bpmbank/PythonJS | 591a80afd8233fb715493591db2b68f1748558d9 | [
"BSD-3-Clause"
] | 10 | 2015-02-03T02:33:09.000Z | 2021-11-09T21:41:00.000Z | regtests/str/mul.py | bpmbank/PythonJS | 591a80afd8233fb715493591db2b68f1748558d9 | [
"BSD-3-Clause"
] | 61 | 2015-01-02T12:01:56.000Z | 2021-12-08T07:16:16.000Z | """string multiplication"""
def main():
a = 'hi'
b = a * 2
TestError( b == 'hihi' )
| 10 | 27 | 0.522222 |
def main():
a = 'hi'
b = a * 2
TestError( b == 'hihi' )
| true | true |
f71ca4a04ecbc21aada0d63286c6160730dff7df | 1,204 | py | Python | pyro/distributions/reflected.py | ajrcampbell/pyro | 37680e6d08f20cda95729427143f17875484b21d | [
"MIT"
] | null | null | null | pyro/distributions/reflected.py | ajrcampbell/pyro | 37680e6d08f20cda95729427143f17875484b21d | [
"MIT"
] | null | null | null | pyro/distributions/reflected.py | ajrcampbell/pyro | 37680e6d08f20cda95729427143f17875484b21d | [
"MIT"
] | null | null | null | from torch.distributions import constraints
from torch.distributions.transforms import AbsTransform
from pyro.distributions.torch import TransformedDistribution
class ReflectedDistribution(TransformedDistribution):
"""
Equivalent to ``TransformedDistribution(base_dist, AbsTransform())``,
but additionally... | 37.625 | 79 | 0.709302 | from torch.distributions import constraints
from torch.distributions.transforms import AbsTransform
from pyro.distributions.torch import TransformedDistribution
class ReflectedDistribution(TransformedDistribution):
support = constraints.positive
def __init__(self, base_dist, validate_args=None):
if ... | true | true |
f71ca57230e7a9c4e629ca823816dd4a71bdd7a4 | 572 | py | Python | localflavor/in_/models.py | stephendwolff/django-localflavor | 082d8539d2797c431bec38fe85e7894ea74b07ac | [
"BSD-3-Clause"
] | null | null | null | localflavor/in_/models.py | stephendwolff/django-localflavor | 082d8539d2797c431bec38fe85e7894ea74b07ac | [
"BSD-3-Clause"
] | null | null | null | localflavor/in_/models.py | stephendwolff/django-localflavor | 082d8539d2797c431bec38fe85e7894ea74b07ac | [
"BSD-3-Clause"
] | null | null | null | from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from .in_states import STATE_CHOICES
class INStateField(CharField):
"""
A model field that forms represent as a ``forms.INStateField`` field and
stores the two-letter Indian state abbreviation in the dat... | 31.777778 | 76 | 0.708042 | from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from .in_states import STATE_CHOICES
class INStateField(CharField):
description = _("Indian state (two uppercase letters)")
def __init__(self, *args, **kwargs):
kwargs['choices'] = STATE_CHOICES
... | true | true |
f71ca6f85ce1ce3a97c314e0b3fd3109c786d615 | 31,747 | py | Python | bot/orders/models.py | psemdel/py-trading-bot | 69da4164b3f6a3ed3e6dc81d5aefc0273b4cb019 | [
"MIT"
] | null | null | null | bot/orders/models.py | psemdel/py-trading-bot | 69da4164b3f6a3ed3e6dc81d5aefc0273b4cb019 | [
"MIT"
] | 1 | 2022-02-07T21:13:55.000Z | 2022-02-07T21:13:55.000Z | bot/orders/models.py | psemdel/py-trading-bot | 69da4164b3f6a3ed3e6dc81d5aefc0273b4cb019 | [
"MIT"
] | null | null | null | from django.db import models
from django.utils import timezone
from django.db.models import Q
import asyncio
from ib_insync import IB, Stock, MarketOrder, util
from core.common import empty_append
from core.indicators import rel_dif
import vectorbtpro as vbt
import sys
import math
import pandas as pd
import numpy a... | 35.953567 | 270 | 0.576936 | from django.db import models
from django.utils import timezone
from django.db.models import Q
import asyncio
from ib_insync import IB, Stock, MarketOrder, util
from core.common import empty_append
from core.indicators import rel_dif
import vectorbtpro as vbt
import sys
import math
import pandas as pd
import numpy a... | true | true |
f71ca7306894b8080e9f8813e913c2b35a942d36 | 851 | py | Python | src/lib/enums.py | BlackParure/AI-StarCraft-II | 7feee4addff9881b3c735791f4a43421f813fcfc | [
"Apache-2.0"
] | 7 | 2019-01-17T16:46:24.000Z | 2020-09-09T06:35:26.000Z | src/lib/enums.py | BlackParure/AI-StarCraft-II | 7feee4addff9881b3c735791f4a43421f813fcfc | [
"Apache-2.0"
] | null | null | null | src/lib/enums.py | BlackParure/AI-StarCraft-II | 7feee4addff9881b3c735791f4a43421f813fcfc | [
"Apache-2.0"
] | null | null | null | from easydict import EasyDict as edict
# the corresponding semantics to the index of
# obs.observation.feature_minimap and obs.observation.feature_screen
feature_mini_id = edict()
feature_mini_id.HEIGHT_MAP = 0
feature_mini_id.VISIBILITY = 1
feature_mini_id.CREEP = 2
feature_mini_id.CAMERA = 3
feature_mini_id.PLAYER_... | 29.344828 | 68 | 0.836663 | from easydict import EasyDict as edict
feature_mini_id = edict()
feature_mini_id.HEIGHT_MAP = 0
feature_mini_id.VISIBILITY = 1
feature_mini_id.CREEP = 2
feature_mini_id.CAMERA = 3
feature_mini_id.PLAYER_ID = 4
feature_mini_id.PLAYER_RELATIVE = 5
feature_mini_id.PLAYER_SELECTED = 6
feature_screen_id = edict()
featu... | true | true |
f71ca8df5ac6d2ef263acfbbb27f84f925bf74a8 | 455 | py | Python | projects_api/migrations/0032_user.py | sorianos/profile-rest-api | 453b326cf067a07455772c32050a17c31b5dc71a | [
"MIT"
] | null | null | null | projects_api/migrations/0032_user.py | sorianos/profile-rest-api | 453b326cf067a07455772c32050a17c31b5dc71a | [
"MIT"
] | 5 | 2021-03-19T11:56:51.000Z | 2022-02-10T14:08:09.000Z | projects_api/migrations/0032_user.py | sorianos/profile-rest-api | 453b326cf067a07455772c32050a17c31b5dc71a | [
"MIT"
] | 1 | 2020-10-29T17:41:34.000Z | 2020-10-29T17:41:34.000Z | # Generated by Django 2.2 on 2021-01-12 07:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects_api', '0031_auto_20201217_2330'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
... | 22.75 | 114 | 0.589011 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects_api', '0031_auto_20201217_2330'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True... | true | true |
f71ca96e2c4377bd676e8a3d35dfed029ac7363e | 16,669 | py | Python | web2py/applications/ControleEstoque/languages/fr.py | GuizaoBR/Controle-Estoque | b4d7e3c665a14ea77224fa448aaf7e3d4d6fe4ed | [
"Apache-2.0"
] | null | null | null | web2py/applications/ControleEstoque/languages/fr.py | GuizaoBR/Controle-Estoque | b4d7e3c665a14ea77224fa448aaf7e3d4d6fe4ed | [
"Apache-2.0"
] | null | null | null | web2py/applications/ControleEstoque/languages/fr.py | GuizaoBR/Controle-Estoque | b4d7e3c665a14ea77224fa448aaf7e3d4d6fe4ed | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
{
'!langcode!': 'fr',
'!langname!': 'Français',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" est une expression optionnelle comme "champ1=\'nouvellevaleur\'". Vous ne pouvez mettre à jour ou supprimer les résultats ... | 52.91746 | 293 | 0.669866 |
{
'!langcode!': 'fr',
'!langname!': 'Français',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" est une expression optionnelle comme "champ1=\'nouvellevaleur\'". Vous ne pouvez mettre à jour ou supprimer les résultats d\'un JOIN',
'%d/%m/%Y'... | true | true |
f71ca9b490a0a319f83ff81055834fce51a392e2 | 701 | py | Python | tests/ext/test_envconfig.py | Zipmatch/zipmatch-content | ead1caca63aaa4acdb092747ed03203670b50e63 | [
"BSD-3-Clause"
] | null | null | null | tests/ext/test_envconfig.py | Zipmatch/zipmatch-content | ead1caca63aaa4acdb092747ed03203670b50e63 | [
"BSD-3-Clause"
] | null | null | null | tests/ext/test_envconfig.py | Zipmatch/zipmatch-content | ead1caca63aaa4acdb092747ed03203670b50e63 | [
"BSD-3-Clause"
] | null | null | null | import pytest
from content.ext.envconfig import EnvConfig
@pytest.mark.parametrize('use_init_app', [True, False])
def test_ext_init(app, mocker, use_init_app):
mock_init_app = mocker.patch.object(EnvConfig, 'init_app')
if use_init_app:
ext = EnvConfig()
ext.init_app(app)
else:
Env... | 25.035714 | 62 | 0.653352 | import pytest
from content.ext.envconfig import EnvConfig
@pytest.mark.parametrize('use_init_app', [True, False])
def test_ext_init(app, mocker, use_init_app):
mock_init_app = mocker.patch.object(EnvConfig, 'init_app')
if use_init_app:
ext = EnvConfig()
ext.init_app(app)
else:
Env... | true | true |
f71ca9df83a8f9e1e8cf5e848d1ced2172679a2a | 8,631 | py | Python | 2019/07_AmplificationCircuit/amp.py | deanearlwright/AdventOfCode | ca4cf6315c0efa38bd7748fb6f4bc99e7934871d | [
"MIT"
] | 1 | 2021-01-03T23:09:28.000Z | 2021-01-03T23:09:28.000Z | 2019/07_AmplificationCircuit/amp.py | deanearlwright/AdventOfCode | ca4cf6315c0efa38bd7748fb6f4bc99e7934871d | [
"MIT"
] | 6 | 2020-12-26T21:02:42.000Z | 2020-12-26T21:02:52.000Z | 2019/07_AmplificationCircuit/amp.py | deanearlwright/AdventOfCode | ca4cf6315c0efa38bd7748fb6f4bc99e7934871d | [
"MIT"
] | null | null | null | # ======================================================================
# Amplification Circuit
# Advent of Code 2019 Day 07 -- Eric Wastl -- https://adventofcode.com
#
# Computer simulation by Dr. Dean Earl Wright III
# ======================================================================
# ===============... | 36.884615 | 94 | 0.446993 |
from __future__ import print_function
from itertools import permutations
import intcode
PHASES = '01234'
FEEDBACK = '56789'
LETTERS = 'ABCDE'
class Amps(object):
def __init__(self, num=5, inp=0, text=None, feedback=False):
self.amps = []
self.n... | true | true |
f71caa1994d573bc106273e8c7f0d7dd6210d086 | 61,405 | py | Python | configure.py | luyangny/Cat-detection | 6bdf989520ca6aba4cde30e48a6ea869db6eeee6 | [
"Apache-2.0"
] | null | null | null | configure.py | luyangny/Cat-detection | 6bdf989520ca6aba4cde30e48a6ea869db6eeee6 | [
"Apache-2.0"
] | null | null | null | configure.py | luyangny/Cat-detection | 6bdf989520ca6aba4cde30e48a6ea869db6eeee6 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 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... | 37.442073 | 80 | 0.689651 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import errno
import os
import platform
import re
import subprocess
import sys
try:
from shutil import which
except ImportError:
from distutils.spawn import find_executable a... | true | true |
f71caae6f9c23667ccfce560a4892f8c3a10bf60 | 7,955 | py | Python | utils/dataset_preprocess.py | eliasyin/LCF-ATEPC | 83ae8a729b617ae34f562e5f52b62cb366dcc103 | [
"MIT"
] | 137 | 2019-12-18T15:38:18.000Z | 2022-03-26T15:26:19.000Z | utils/dataset_preprocess.py | eliasyin/LCF-ATEPC | 83ae8a729b617ae34f562e5f52b62cb366dcc103 | [
"MIT"
] | 45 | 2019-12-20T08:24:12.000Z | 2022-03-31T12:43:19.000Z | utils/dataset_preprocess.py | eliasyin/LCF-ATEPC | 83ae8a729b617ae34f562e5f52b62cb366dcc103 | [
"MIT"
] | 34 | 2020-01-03T02:59:18.000Z | 2022-03-30T01:44:09.000Z | import os
import copy
def is_similar(s1, s2):
count = 0.0
for token in s1.split(' '):
if token in s2:
count += 1
# if count / len(s1.split(' ')) >= 0.7 and abs(len(s1.split(' '))-len(s2.split(' '))<5):
if count / len(s1.split(' ')) >= 0.7 and count / len(s2.split(' ')) >= 0.7:
... | 36.828704 | 136 | 0.595726 | import os
import copy
def is_similar(s1, s2):
count = 0.0
for token in s1.split(' '):
if token in s2:
count += 1
if count / len(s1.split(' ')) >= 0.7 and count / len(s2.split(' ')) >= 0.7:
return True
else:
return False
def assemble_aspects(fname):
fin = o... | true | true |
f71cab1867cc22a6cea57f7a9832a1702c206111 | 2,746 | py | Python | makbe/expanders/tca9555.py | kazhida/makbe-py | b2840251118959a826fe8d3e2e84c2000dba3081 | [
"MIT"
] | null | null | null | makbe/expanders/tca9555.py | kazhida/makbe-py | b2840251118959a826fe8d3e2e84c2000dba3081 | [
"MIT"
] | 1 | 2021-11-29T08:23:50.000Z | 2021-11-29T08:23:50.000Z | makbe/expanders/tca9555.py | kazhida/makbe-py | b2840251118959a826fe8d3e2e84c2000dba3081 | [
"MIT"
] | null | null | null | # MIT License
#
# Copyright (c) 2021 Kazuyuki HIDA
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... | 34.759494 | 80 | 0.643117 |
from .. key_switch import nop_switch
from .. import IoExpander, KeySwitch
class TCA9555(IoExpander):
def __init__(self, dev_address: int):
self.dev_address = dev_address + 0x20
self.switches = []
for i in range(16):
self.switches.append(nop_switch())
... | true | true |
f71cab3e710d8cc552a1054d037bb361fdbacb7d | 2,386 | py | Python | old/test_reverse_linked_list.py | kurtrm/data_structures_rev | 58f425a877898a45595de9c57c7eb8e087a0c3a2 | [
"MIT"
] | null | null | null | old/test_reverse_linked_list.py | kurtrm/data_structures_rev | 58f425a877898a45595de9c57c7eb8e087a0c3a2 | [
"MIT"
] | null | null | null | old/test_reverse_linked_list.py | kurtrm/data_structures_rev | 58f425a877898a45595de9c57c7eb8e087a0c3a2 | [
"MIT"
] | null | null | null | """Test of the reversed linked list."""
import pytest
@pytest.fixture
def linked_list():
"""Make linked_list for testing."""
from linked_list import LinkedList
linked_list = LinkedList([1, 2, 3])
return linked_list
def test_empty_linked_list(linked_list):
"""Test exception from empty linked_lis... | 34.57971 | 85 | 0.754401 |
import pytest
@pytest.fixture
def linked_list():
from linked_list import LinkedList
linked_list = LinkedList([1, 2, 3])
return linked_list
def test_empty_linked_list(linked_list):
from reverse_linked_list import reverse_linked_list
linked_list.pop()
linked_list.pop()
linked_list.pop()
... | true | true |
f71cabbacd1f7c032bc3b010d748f5f29a9c6426 | 442 | py | Python | form.py | GreciaFlores1996/CursoPython | b81edad009ea36786d28ca5781c63df0f5376ac5 | [
"MIT"
] | null | null | null | form.py | GreciaFlores1996/CursoPython | b81edad009ea36786d28ca5781c63df0f5376ac5 | [
"MIT"
] | 1 | 2019-08-20T22:20:45.000Z | 2019-08-20T22:21:38.000Z | form.py | GreciaFlores1996/CursoPython | b81edad009ea36786d28ca5781c63df0f5376ac5 | [
"MIT"
] | null | null | null | from wtforms import Form
from wtforms import StringField
from wtforms import IntegerField
from wtforms.validators import DataRequired
class EmailForm(Form):
name = StringField('name', validators=[DataRequired()])
email = StringField('email', validators=[DataRequired()])
class LoginForm(Form):
username =... | 29.466667 | 67 | 0.757919 | from wtforms import Form
from wtforms import StringField
from wtforms import IntegerField
from wtforms.validators import DataRequired
class EmailForm(Form):
name = StringField('name', validators=[DataRequired()])
email = StringField('email', validators=[DataRequired()])
class LoginForm(Form):
username =... | true | true |
f71cabd18bcfe59a84a59dd1c41d1bd8fc494488 | 865 | py | Python | plaidctf/2016/rage/netloop.py | petermuller/plaidctf | 68274ce096c4c8456a566911d23f4672cddb31a3 | [
"MIT"
] | null | null | null | plaidctf/2016/rage/netloop.py | petermuller/plaidctf | 68274ce096c4c8456a566911d23f4672cddb31a3 | [
"MIT"
] | null | null | null | plaidctf/2016/rage/netloop.py | petermuller/plaidctf | 68274ce096c4c8456a566911d23f4672cddb31a3 | [
"MIT"
] | null | null | null | from brute import brute
from pwn import *
from hashlib import md5
import numpy as np
bru = 25
best_imgs = dict()
for p in xrange(1):
for r in xrange(1):
for k in xrange(bru):
conn = remote('localhost', 29281)
salt = conn.recvn(12)
for i in brute(length=6, ramp=False):
if True:
print('Broke md5 wit... | 24.027778 | 52 | 0.581503 | from brute import brute
from pwn import *
from hashlib import md5
import numpy as np
bru = 25
best_imgs = dict()
for p in xrange(1):
for r in xrange(1):
for k in xrange(bru):
conn = remote('localhost', 29281)
salt = conn.recvn(12)
for i in brute(length=6, ramp=False):
if True:
print('Broke md5 wit... | false | true |
f71cabef85002e6d78fa7bf1e3356fe2e5b10593 | 2,601 | py | Python | src/DSGRN/Query/Database.py | yingxinac/DSGRN | b5bc64e5a99e6d266f6ac5ba7ac9d04954f12d32 | [
"MIT"
] | 9 | 2017-10-15T20:49:36.000Z | 2022-02-24T19:26:39.000Z | src/DSGRN/Query/Database.py | yingxinac/DSGRN | b5bc64e5a99e6d266f6ac5ba7ac9d04954f12d32 | [
"MIT"
] | 19 | 2015-07-02T15:59:06.000Z | 2020-06-09T18:13:05.000Z | src/DSGRN/Query/Database.py | yingxinac/DSGRN | b5bc64e5a99e6d266f6ac5ba7ac9d04954f12d32 | [
"MIT"
] | 21 | 2015-11-06T16:28:34.000Z | 2019-09-20T09:26:54.000Z | import sqlite3
import graphviz
from DSGRN._dsgrn import *
from functools import reduce
from DSGRN.Query.Logging import LogToSTDOUT
class Database:
def __init__(self, database_name):
"""
Initialize a DSGRN database object
"""
self.dbname = database_name
self.conn = sqlite3.connect(database_name)
... | 38.820896 | 153 | 0.708958 | import sqlite3
import graphviz
from DSGRN._dsgrn import *
from functools import reduce
from DSGRN.Query.Logging import LogToSTDOUT
class Database:
def __init__(self, database_name):
self.dbname = database_name
self.conn = sqlite3.connect(database_name)
self.cursor = self.conn.cursor()
sqlexpres... | true | true |
f71cacb71c497b993580e8b6ab79d5b35f0c8185 | 7,853 | py | Python | lit_nlp/examples/sst_pytorch_demo.py | johnson7788/lit | 3eb824b01e0f72a5486124b16056bf912465debc | [
"Apache-2.0"
] | 1 | 2021-04-12T22:57:04.000Z | 2021-04-12T22:57:04.000Z | lit_nlp/examples/sst_pytorch_demo.py | johnson7788/lit | 3eb824b01e0f72a5486124b16056bf912465debc | [
"Apache-2.0"
] | 4 | 2022-02-14T19:37:07.000Z | 2022-02-27T20:24:08.000Z | lit_nlp/examples/sst_pytorch_demo.py | haaami01/lit | 3eb824b01e0f72a5486124b16056bf912465debc | [
"Apache-2.0"
] | null | null | null | # Lint as: python3
r"""Code example for a custom model, using PyTorch.
This demo shows how to use a custom model with LIT, in just a few lines of code.
We'll use a transformers model, with a minimal amount of code to implement the
LIT API. Compared to models/glue_models.py, this has fewer features, but the
code is mor... | 37.395238 | 86 | 0.706736 |
import re
from absl import app
from absl import flags
from absl import logging
from lit_nlp import dev_server
from lit_nlp import server_flags
from lit_nlp.api import model as lit_model
from lit_nlp.api import types as lit_types
from lit_nlp.examples.datasets import glue
from lit_nlp.lib import utils
import torch
imp... | true | true |
f71cad4b7e4b8cf28664ced9914cb52c172687a1 | 16,093 | py | Python | bioinformatics-programs/prepareNames.py | dengzq1234/TREND | 0374da1fbdd3b5236445d62f07ea84485074b437 | [
"MIT"
] | null | null | null | bioinformatics-programs/prepareNames.py | dengzq1234/TREND | 0374da1fbdd3b5236445d62f07ea84485074b437 | [
"MIT"
] | null | null | null | bioinformatics-programs/prepareNames.py | dengzq1234/TREND | 0374da1fbdd3b5236445d62f07ea84485074b437 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# Author: Vadim Gumerov
# 03.04/2019
import sys, getopt
import re
from ete2 import Tree
from Bio import SeqIO
from Bio import Entrez
import time
import collections
import urllib
import json
import math
import multiprocessing
import time
#pip install timeout-decorator
import timeout_decorator
manager ... | 38.685096 | 143 | 0.7182 |
import sys, getopt
import re
from ete2 import Tree
from Bio import SeqIO
from Bio import Entrez
import time
import collections
import urllib
import json
import math
import multiprocessing
import time
import timeout_decorator
manager = multiprocessing.Manager()
Entrez.email = "A.N.Other@example.com"
ENTREZ_EFETCH_... | false | true |
f71cae616991607462e2bfde3a5cc705076fafbc | 6,982 | py | Python | geektime_ebook_maker/spider/mini_spider.py | fakeYanss/geektime_ebook_maker | b536f3bdaf84f8180aac1d2601be8058e0e91115 | [
"MIT"
] | 33 | 2018-08-13T02:52:15.000Z | 2018-10-16T03:38:11.000Z | geektime_ebook_maker/spider/mini_spider.py | fakeYanss/geektime_ebook_maker | b536f3bdaf84f8180aac1d2601be8058e0e91115 | [
"MIT"
] | null | null | null | geektime_ebook_maker/spider/mini_spider.py | fakeYanss/geektime_ebook_maker | b536f3bdaf84f8180aac1d2601be8058e0e91115 | [
"MIT"
] | 4 | 2018-08-13T05:26:11.000Z | 2018-09-06T09:59:52.000Z | # coding=utf8
import os
from threading import Thread
try:
from queue import Queue, Empty as QueueEmpty
except ImportError:
from Queue import Queue, Empty as QueueEmpty
import requests
import logging
import traceback
error_logger = logging.getLogger('error')
error_logger.setLevel(logging.ERROR)
ERROR_STATU... | 32.474419 | 136 | 0.596534 |
import os
from threading import Thread
try:
from queue import Queue, Empty as QueueEmpty
except ImportError:
from Queue import Queue, Empty as QueueEmpty
import requests
import logging
import traceback
error_logger = logging.getLogger('error')
error_logger.setLevel(logging.ERROR)
ERROR_STATUS = -1
def ... | true | true |
f71caea71cfc518c2ef4111293c2ff14384cf596 | 1,255 | py | Python | src/sentry/api/endpoints/project_environments.py | apragacz/sf-sentry | 2fdd6c1195c29a1d401d1cd538c22ea68556699a | [
"BSD-3-Clause"
] | 1 | 2018-03-05T15:40:12.000Z | 2018-03-05T15:40:12.000Z | src/sentry/api/endpoints/project_environments.py | pitchin/sentry | ff6f260e9edb726374d2e4f455ff8b3d0ecd551e | [
"BSD-3-Clause"
] | 1 | 2018-08-22T16:49:48.000Z | 2018-08-22T16:49:48.000Z | src/sentry/api/endpoints/project_environments.py | pitchin/sentry | ff6f260e9edb726374d2e4f455ff8b3d0ecd551e | [
"BSD-3-Clause"
] | 1 | 2018-07-02T09:46:44.000Z | 2018-07-02T09:46:44.000Z | from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.serializers import serialize
from sentry.models import EnvironmentProject
environment_visibility_filter_options = {
'all': lambda queryset: queryset,
'hidd... | 35.857143 | 92 | 0.713147 | from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.serializers import serialize
from sentry.models import EnvironmentProject
environment_visibility_filter_options = {
'all': lambda queryset: queryset,
'hidd... | true | true |
f71caf4a0f239065a54f05daee5fc3a53ea19433 | 696 | py | Python | tarefas-poo/lista-03/tribo/view/paineis/painel_cria_tribo.py | victoriaduarte/POO_UFSC | 0c65b4f26383d1e3038d8469bd91fd2c0cb98c1a | [
"MIT"
] | null | null | null | tarefas-poo/lista-03/tribo/view/paineis/painel_cria_tribo.py | victoriaduarte/POO_UFSC | 0c65b4f26383d1e3038d8469bd91fd2c0cb98c1a | [
"MIT"
] | null | null | null | tarefas-poo/lista-03/tribo/view/paineis/painel_cria_tribo.py | victoriaduarte/POO_UFSC | 0c65b4f26383d1e3038d8469bd91fd2c0cb98c1a | [
"MIT"
] | null | null | null | # --------------------------
# UFSC - CTC - INE - INE5663
# Exercício da Tribo
# --------------------------
# Classe responsável por criar uma tribo
#
from model.tribo import Tribo
from view.paineis.painel_abstrato import PainelAbstrato
class PainelCriaTribo(PainelAbstrato):
def __init__(self, iu):
super... | 30.26087 | 80 | 0.627874 |
from model.tribo import Tribo
from view.paineis.painel_abstrato import PainelAbstrato
class PainelCriaTribo(PainelAbstrato):
def __init__(self, iu):
super().__init__('Criar Tribo', iu)
def _interaja(self):
nome = input('Nome da tribo: ')
qtd_guerreiros = int(input('Quantidade m... | true | true |
f71cb0c1773a3937199f2475478d123c6d026639 | 3,726 | py | Python | src/lupuxt2py/constants.py | ChrisKeck/lupuxt2py | 73dc0c636c81fc7007044d9e6c2d34a1794ebae3 | [
"MIT"
] | null | null | null | src/lupuxt2py/constants.py | ChrisKeck/lupuxt2py | 73dc0c636c81fc7007044d9e6c2d34a1794ebae3 | [
"MIT"
] | null | null | null | src/lupuxt2py/constants.py | ChrisKeck/lupuxt2py | 73dc0c636c81fc7007044d9e6c2d34a1794ebae3 | [
"MIT"
] | null | null | null | # Used in setup.py
# -*- coding: utf-8 -*-
VERSION = "0.1.1"
PROJECT_PACKAGE_NAME = "lupupy"
PROJECT_LICENSE = "MIT"
PROJECT_URL = "http://www.github.com/majuss/lupupy"
PROJECT_DESCRIPTION = "A python cli for Lupusec alarm panels."
PROJECT_LONG_DESCRIPTION = (
"lupupy is a python3 interface for"
" the Lupus Ele... | 32.4 | 83 | 0.766774 |
VERSION = "0.1.1"
PROJECT_PACKAGE_NAME = "lupupy"
PROJECT_LICENSE = "MIT"
PROJECT_URL = "http://www.github.com/majuss/lupupy"
PROJECT_DESCRIPTION = "A python cli for Lupusec alarm panels."
PROJECT_LONG_DESCRIPTION = (
"lupupy is a python3 interface for"
" the Lupus Electronics alarm panel."
" Its intented... | true | true |
f71cb55ac21dc79bb494db37b62d30dc5c9b3af6 | 597 | py | Python | multilstm_tensorpack/tensorpack/utils/globvars.py | neale/A4C | acbbb3cf14e31a19c12f27306971b4db4feafe09 | [
"MIT"
] | 1 | 2017-03-11T23:10:00.000Z | 2017-03-11T23:10:00.000Z | multilstm_tensorpack/tensorpack/utils/globvars.py | neale/A4C | acbbb3cf14e31a19c12f27306971b4db4feafe09 | [
"MIT"
] | null | null | null | multilstm_tensorpack/tensorpack/utils/globvars.py | neale/A4C | acbbb3cf14e31a19c12f27306971b4db4feafe09 | [
"MIT"
] | 1 | 2021-04-30T15:34:24.000Z | 2021-04-30T15:34:24.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: globvars.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import six
import argparse
__all__ = ['globalns', 'use_global_argument']
if six.PY2:
class NS:
pass
else:
import types
NS = types.SimpleNamespace
globalns = NS()
def use_global_argument(a... | 19.258065 | 63 | 0.649916 |
import six
import argparse
__all__ = ['globalns', 'use_global_argument']
if six.PY2:
class NS:
pass
else:
import types
NS = types.SimpleNamespace
globalns = NS()
def use_global_argument(args):
assert isinstance(args, argparse.Namespace), type(args)
for k, v in six.iteritems(vars(ar... | true | true |
f71cb812c630d4ea90200d9a5c076f1b4590a71e | 1,220 | py | Python | iotbx/command_line/sort_atoms.py | hbrunie/cctbx_project | 2d8cb383d50fe20cdbbe4bebae8ed35fabce61e5 | [
"BSD-3-Clause-LBNL"
] | 2 | 2021-03-18T12:31:57.000Z | 2022-03-14T06:27:06.000Z | iotbx/command_line/sort_atoms.py | hbrunie/cctbx_project | 2d8cb383d50fe20cdbbe4bebae8ed35fabce61e5 | [
"BSD-3-Clause-LBNL"
] | null | null | null | iotbx/command_line/sort_atoms.py | hbrunie/cctbx_project | 2d8cb383d50fe20cdbbe4bebae8ed35fabce61e5 | [
"BSD-3-Clause-LBNL"
] | 1 | 2020-02-04T15:39:06.000Z | 2020-02-04T15:39:06.000Z | # LIBTBX_SET_DISPATCHER_NAME iotbx.pdb.sort_atoms
from __future__ import absolute_import, division, print_function
from libtbx.utils import Usage
import sys
import iotbx.pdb
import mmtbx.model
master_phil_str = """
file_name = None
.type = path
.multiple = False
.optional = False
.style = hidden
"""
def show... | 22.181818 | 73 | 0.685246 |
from __future__ import absolute_import, division, print_function
from libtbx.utils import Usage
import sys
import iotbx.pdb
import mmtbx.model
master_phil_str = """
file_name = None
.type = path
.multiple = False
.optional = False
.style = hidden
"""
def show_usage():
help_msg = """\
iotbx.pdb.sort_atoms ... | true | true |
f71cb8ae677cc7579d50cdb36f7a5ee87a4ab448 | 4,358 | py | Python | Lib/dumbdbm.py | SaadBazaz/ChinesePython | 800955539dda912d4a1621bcf5a700aaaddc012f | [
"CNRI-Python-GPL-Compatible"
] | 3 | 2022-01-30T20:08:24.000Z | 2022-02-12T08:51:12.000Z | Lib/dumbdbm.py | SaadBazaz/ChinesePython | 800955539dda912d4a1621bcf5a700aaaddc012f | [
"CNRI-Python-GPL-Compatible"
] | null | null | null | Lib/dumbdbm.py | SaadBazaz/ChinesePython | 800955539dda912d4a1621bcf5a700aaaddc012f | [
"CNRI-Python-GPL-Compatible"
] | null | null | null | """A dumb and slow but simple dbm clone.
For database spam, spam.dir contains the index (a text file),
spam.bak *may* contain a backup of the index (also a text file),
while spam.dat contains the data (a binary file).
XXX TO DO:
- seems to contain a bug when updating...
- reclaim free space (currently, space once o... | 28.298701 | 78 | 0.543139 | """A dumb and slow but simple dbm clone.
For database spam, spam.dir contains the index (a text file),
spam.bak *may* contain a backup of the index (also a text file),
while spam.dat contains the data (a binary file).
XXX TO DO:
- seems to contain a bug when updating...
- reclaim free space (currently, space once o... | false | true |
f71cb926199d235645c93f0a046fc2b7260452e8 | 1,138 | py | Python | machine-learning-pipeline/airflow/dags/train_simple_model.py | dataength/automating-your-data-pipeline-with-apache-airflow | 19b7fe4a41874708c5927b7c32f9840f4285090c | [
"MIT"
] | 30 | 2020-07-09T17:37:47.000Z | 2022-01-19T04:17:02.000Z | machine-learning-pipeline/airflow/dags/train_simple_model.py | mizzony/automating-your-data-pipeline-with-apache-airflow | 90a1351de6de78c0f0a6fb2e778e2ba3b7c78f5e | [
"MIT"
] | 38 | 2021-08-12T08:01:47.000Z | 2022-03-29T22:29:27.000Z | machine-learning-pipeline/airflow/dags/train_simple_model.py | mizzony/automating-your-data-pipeline-with-apache-airflow | 90a1351de6de78c0f0a6fb2e778e2ba3b7c78f5e | [
"MIT"
] | 22 | 2020-07-10T02:41:39.000Z | 2022-03-23T22:08:52.000Z | import pickle
from airflow import DAG
from airflow.hooks.postgres_hook import PostgresHook
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.utils import timezone
from sklearn.ensemble import RandomForestClassifier
default_args = {
... | 22.76 | 65 | 0.692443 | import pickle
from airflow import DAG
from airflow.hooks.postgres_hook import PostgresHook
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.utils import timezone
from sklearn.ensemble import RandomForestClassifier
default_args = {
... | true | true |
f71cba9b88574b1dfb171079ea67df5863e28a5e | 1,843 | py | Python | nighteen_cpc.py | toddlerya/AnalyzeNPC | 5d16f994ec34300a3050463aad08ad3a1ec1eaba | [
"MIT"
] | 4 | 2018-09-15T02:43:04.000Z | 2022-02-11T01:56:49.000Z | nighteen_cpc.py | toddlerya/AnalyzeNPC | 5d16f994ec34300a3050463aad08ad3a1ec1eaba | [
"MIT"
] | null | null | null | nighteen_cpc.py | toddlerya/AnalyzeNPC | 5d16f994ec34300a3050463aad08ad3a1ec1eaba | [
"MIT"
] | 5 | 2018-03-12T10:01:48.000Z | 2021-11-05T05:34:48.000Z | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# author: toddler
import jieba
import re
import os
from collections import Counter
from wordcloud import WordCloud
import matplotlib.pyplot as plt
def cut_analyze(input_file):
"""
:param input_file: 输入带切词分析的文本路径
:return: (list1, list2) list1切词处理后的列表结果, list2输出... | 29.725806 | 96 | 0.688009 |
import jieba
import re
import os
from collections import Counter
from wordcloud import WordCloud
import matplotlib.pyplot as plt
def cut_analyze(input_file):
cpc_dict_path = u'user_dict/cpc_dictionary.txt'
stop_words_path = u'user_dict/stopword.txt'
with open(input_file) as f:
content = f.rea... | true | true |
f71cbafafa7b775082fc935301d70d2a60767f9b | 6,977 | py | Python | models/render.py | RichTeaMan/duck-game | b47db72e30767411251a43000a9afad7ee11f822 | [
"MIT"
] | null | null | null | models/render.py | RichTeaMan/duck-game | b47db72e30767411251a43000a9afad7ee11f822 | [
"MIT"
] | null | null | null | models/render.py | RichTeaMan/duck-game | b47db72e30767411251a43000a9afad7ee11f822 | [
"MIT"
] | null | null | null | import sys
import math
import pathlib
import bpy
import mathutils
from PIL import Image
modelDir = pathlib.Path(__file__).parent.absolute()
scn = bpy.context.scene
images_created = 0
def update_camera(camera, focus_point=mathutils.Vector((0.0, 0.0, 0.0)), distance=10.0):
"""
Focus the camera to a focus point... | 39.642045 | 118 | 0.694138 | import sys
import math
import pathlib
import bpy
import mathutils
from PIL import Image
modelDir = pathlib.Path(__file__).parent.absolute()
scn = bpy.context.scene
images_created = 0
def update_camera(camera, focus_point=mathutils.Vector((0.0, 0.0, 0.0)), distance=10.0):
looking_direction = camera.location - foc... | true | true |
f71cbc5a7db50b299b464568fe69775d801e45e9 | 1,650 | py | Python | concept_formation/tests/benchmark_cobweb.py | ThomasHoppe/concept_formation | 2468fea78ba46804bf44228519eb33ebc5780d31 | [
"MIT"
] | 47 | 2015-06-08T20:34:18.000Z | 2021-09-26T17:59:06.000Z | concept_formation/tests/benchmark_cobweb.py | ThomasHoppe/concept_formation | 2468fea78ba46804bf44228519eb33ebc5780d31 | [
"MIT"
] | 65 | 2015-07-27T18:16:31.000Z | 2021-10-04T14:02:51.000Z | concept_formation/tests/benchmark_cobweb.py | ThomasHoppe/concept_formation | 2468fea78ba46804bf44228519eb33ebc5780d31 | [
"MIT"
] | 13 | 2015-07-27T13:27:03.000Z | 2022-03-15T02:18:10.000Z | from random import randint
from timeit import timeit
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
def generate_dataset(n_inst, n_attr, n_val):
instances = []
for i in range(n_inst):
i = {}
for j in range(n_attr):
i[str(j)] = randint(1, n_val)
... | 31.132075 | 78 | 0.569697 | from random import randint
from timeit import timeit
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
def generate_dataset(n_inst, n_attr, n_val):
instances = []
for i in range(n_inst):
i = {}
for j in range(n_attr):
i[str(j)] = randint(1, n_val)
... | true | true |
f71cbc803e6c23ac267127d39b3cacff5df2afb2 | 1,759 | py | Python | ddtrace/contrib/starlette/patch.py | p7g/dd-trace-py | 141ac0ab6e9962e3b3bafc9de172076075289a19 | [
"Apache-2.0",
"BSD-3-Clause"
] | 308 | 2016-12-07T16:49:27.000Z | 2022-03-15T10:06:45.000Z | ddtrace/contrib/starlette/patch.py | p7g/dd-trace-py | 141ac0ab6e9962e3b3bafc9de172076075289a19 | [
"Apache-2.0",
"BSD-3-Clause"
] | 1,928 | 2016-11-28T17:13:18.000Z | 2022-03-31T21:43:19.000Z | ddtrace/contrib/starlette/patch.py | p7g/dd-trace-py | 141ac0ab6e9962e3b3bafc9de172076075289a19 | [
"Apache-2.0",
"BSD-3-Clause"
] | 311 | 2016-11-27T03:01:49.000Z | 2022-03-18T21:34:03.000Z | import starlette
from starlette.middleware import Middleware
from starlette.routing import Match
from ddtrace import config
from ddtrace.contrib.asgi.middleware import TraceMiddleware
from ddtrace.internal.logger import get_logger
from ddtrace.internal.utils.wrappers import unwrap as _u
from ddtrace.vendor.wrapt impor... | 25.867647 | 111 | 0.69585 | import starlette
from starlette.middleware import Middleware
from starlette.routing import Match
from ddtrace import config
from ddtrace.contrib.asgi.middleware import TraceMiddleware
from ddtrace.internal.logger import get_logger
from ddtrace.internal.utils.wrappers import unwrap as _u
from ddtrace.vendor.wrapt impor... | true | true |
f71cbe052a1401c87b58ad7ee12061265e925398 | 3,707 | py | Python | locations/spiders/mcdonalds_hu.py | thismakessand/alltheplaces | b6116199844c9e88bff3a691290f07a7457470ba | [
"MIT"
] | 1 | 2019-08-19T10:00:55.000Z | 2019-08-19T10:00:55.000Z | locations/spiders/mcdonalds_hu.py | thismakessand/alltheplaces | b6116199844c9e88bff3a691290f07a7457470ba | [
"MIT"
] | null | null | null | locations/spiders/mcdonalds_hu.py | thismakessand/alltheplaces | b6116199844c9e88bff3a691290f07a7457470ba | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class McDonaldsHUSpider(scrapy.Spider):
name = "mcdonalds_hu"
allowed_domains = ["www.mcdonalds.hu"]
start_urls = (
'https://www.mcdonalds.hu/ettermeink',
)
def store_hours(self, data... | 34.324074 | 147 | 0.514702 |
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class McDonaldsHUSpider(scrapy.Spider):
name = "mcdonalds_hu"
allowed_domains = ["www.mcdonalds.hu"]
start_urls = (
'https://www.mcdonalds.hu/ettermeink',
)
def store_hours(self, data):
day_groups =... | true | true |
f71cbe39c1107e8c3db2f02071238dd85d13bb46 | 8,346 | py | Python | src/ml_rasa/scripts/preprocessors/check_english.py | GrigalashviliT/spoilerBlocker | 18a5e9689099d3b631a15ed20cc84a043f324055 | [
"MIT"
] | 5 | 2020-05-20T16:59:04.000Z | 2021-08-22T18:30:47.000Z | src/ml_rasa/scripts/preprocessors/check_english.py | GrigalashviliT/spoilerBlocker | 18a5e9689099d3b631a15ed20cc84a043f324055 | [
"MIT"
] | 10 | 2020-05-20T16:07:04.000Z | 2020-07-22T19:21:16.000Z | src/ml_rasa/scripts/preprocessors/check_english.py | GrigalashviliT/spoilerBlocker | 18a5e9689099d3b631a15ed20cc84a043f324055 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import re
from re import sub
from typing import Any, List, Text
from functools import reduce
from rasa.nlu.components import Component
from rasa.nlu.config impo... | 107 | 6,589 | 0.619458 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import re
from re import sub
from typing import Any, List, Text
from functools import reduce
from rasa.nlu.components import Component
from rasa.nlu.config impo... | true | true |
f71cbe9a6893b097ff92eef32e8a4f740fdc19a0 | 13,481 | py | Python | wheat/util/streamable.py | grayfallstown/wheat-blockchain | f391cdd30a0cbcdb2adf4439a25581fd28b42c1f | [
"Apache-2.0"
] | null | null | null | wheat/util/streamable.py | grayfallstown/wheat-blockchain | f391cdd30a0cbcdb2adf4439a25581fd28b42c1f | [
"Apache-2.0"
] | null | null | null | wheat/util/streamable.py | grayfallstown/wheat-blockchain | f391cdd30a0cbcdb2adf4439a25581fd28b42c1f | [
"Apache-2.0"
] | null | null | null | # flake8: noqa
# pylint: disable
from __future__ import annotations
import dataclasses
import io
import pprint
import sys
from enum import Enum
from typing import Any, BinaryIO, Dict, List, Tuple, Type, Callable, Optional, Iterator
from blspy import G1Element, G2Element, PrivateKey
from wheat.types.blockchain_format... | 37.551532 | 111 | 0.649952 |
from __future__ import annotations
import dataclasses
import io
import pprint
import sys
from enum import Enum
from typing import Any, BinaryIO, Dict, List, Tuple, Type, Callable, Optional, Iterator
from blspy import G1Element, G2Element, PrivateKey
from wheat.types.blockchain_format.program import Program, Serial... | true | true |
f71cbf4460d98bc10c011e9a945b70eb738776be | 853 | py | Python | setup.py | rwindsor1/DICOMcat | 1f6549882cce93f270ad24d4c4c4140d51536789 | [
"MIT"
] | 1 | 2021-08-09T15:50:53.000Z | 2021-08-09T15:50:53.000Z | setup.py | rwindsor1/DICOMcat | 1f6549882cce93f270ad24d4c4c4140d51536789 | [
"MIT"
] | null | null | null | setup.py | rwindsor1/DICOMcat | 1f6549882cce93f270ad24d4c4c4140d51536789 | [
"MIT"
] | null | null | null | from setuptools import setup
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(name= 'dicomcat',
version= '0.1',
description='A simple python-based tool based on imgcat f... | 34.12 | 101 | 0.681125 | from setuptools import setup
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(name= 'dicomcat',
version= '0.1',
description='A simple python-based tool based on imgcat f... | true | true |
f71cbfad5d23526173717cefa4699e471cc4b889 | 522 | py | Python | 16 Exception Handling/finallydemo.py | Himanshu44626748/Learn-Python | f3a4d997f2d29b146e5f7434f4801ae94bc3483f | [
"MIT"
] | 2 | 2020-03-16T14:57:44.000Z | 2020-11-29T07:45:54.000Z | 16 Exception Handling/finallydemo.py | Himanshu44626748/Learn-Python | f3a4d997f2d29b146e5f7434f4801ae94bc3483f | [
"MIT"
] | null | null | null | 16 Exception Handling/finallydemo.py | Himanshu44626748/Learn-Python | f3a4d997f2d29b146e5f7434f4801ae94bc3483f | [
"MIT"
] | 1 | 2020-08-13T07:59:02.000Z | 2020-08-13T07:59:02.000Z | try:
f = open("myfile","w")
a,b = [int(x) for x in input("Enter two numbers:").split()]
c = a/b
f.write("Writing %d into file" %c)
except ZeroDivisionError:
print("Division by zero is not allowed")
print("Please enter a non zero number")
finally:
f.close() # Writi... | 37.285714 | 189 | 0.632184 | try:
f = open("myfile","w")
a,b = [int(x) for x in input("Enter two numbers:").split()]
c = a/b
f.write("Writing %d into file" %c)
except ZeroDivisionError:
print("Division by zero is not allowed")
print("Please enter a non zero number")
finally:
f.close()
pr... | true | true |
f71cbfefe5963b92d2e1699d24dfdedb87ab4f03 | 1,191 | py | Python | benchmarks/python/microbench.py | cyntsh/dex-lang | 88a647c4b7347cc4124d9b03b90b4348c8125698 | [
"BSD-Source-Code"
] | 1,223 | 2019-10-25T12:35:46.000Z | 2022-03-30T02:08:54.000Z | benchmarks/python/microbench.py | cyntsh/dex-lang | 88a647c4b7347cc4124d9b03b90b4348c8125698 | [
"BSD-Source-Code"
] | 425 | 2019-10-27T21:12:15.000Z | 2022-03-31T17:47:57.000Z | benchmarks/python/microbench.py | cyntsh/dex-lang | 88a647c4b7347cc4124d9b03b90b4348c8125698 | [
"BSD-Source-Code"
] | 87 | 2019-10-26T17:41:23.000Z | 2022-02-05T23:32:04.000Z | # Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
import json
from functools import partial
import time
import jax.numpy as np
import jax.random as random
from jax import jit... | 24.8125 | 63 | 0.699412 |
import json
from functools import partial
import time
import jax.numpy as np
import jax.random as random
from jax import jit
from jax.config import config
config.enable_omnistaging()
np.dot(1.0, 1.0)
def benchit(bench_name, x, f):
f_jitted = jit(f)
t0 = time.time()
f_jitted(x).block_until_ready()
t1 ... | true | true |
f71cc027fdd19119fb0399b5df5021a92a9837ac | 2,248 | py | Python | e3d/plugin_management/PluginHandlers.py | jr-garcia/Engendro3D | 93a6a6c26be2b9a8c1520e9d83516c39532ab1ed | [
"MIT"
] | 8 | 2017-04-19T03:59:43.000Z | 2020-04-29T00:29:12.000Z | e3d/plugin_management/PluginHandlers.py | jr-garcia/Engendro3D | 93a6a6c26be2b9a8c1520e9d83516c39532ab1ed | [
"MIT"
] | null | null | null | e3d/plugin_management/PluginHandlers.py | jr-garcia/Engendro3D | 93a6a6c26be2b9a8c1520e9d83516c39532ab1ed | [
"MIT"
] | 3 | 2018-04-26T16:57:46.000Z | 2021-03-01T05:48:06.000Z | from os import path
from shutil import make_archive
import os
from json import load, dump
PLUGINEXTENSION = '.epf'
DESCRIPTIONNAME = 'description'
def packPluginFromFolder(folderPath):
folderPath = path.abspath(folderPath)
if not path.exists(folderPath):
raise FileNotFoundError('the folder does not ... | 32.57971 | 105 | 0.666815 | from os import path
from shutil import make_archive
import os
from json import load, dump
PLUGINEXTENSION = '.epf'
DESCRIPTIONNAME = 'description'
def packPluginFromFolder(folderPath):
folderPath = path.abspath(folderPath)
if not path.exists(folderPath):
raise FileNotFoundError('the folder does not ... | true | true |
f71cc05cd87321ac0280e9c1dac9a793ff504e60 | 6,120 | py | Python | tests/test_enums.py | eerimoq/sython | 90937bf44b798b9c1ae0d18e31e11e95967b46c6 | [
"MIT"
] | null | null | null | tests/test_enums.py | eerimoq/sython | 90937bf44b798b9c1ae0d18e31e11e95967b46c6 | [
"MIT"
] | null | null | null | tests/test_enums.py | eerimoq/sython | 90937bf44b798b9c1ae0d18e31e11e95967b46c6 | [
"MIT"
] | null | null | null | from .utils import TestCase
from .utils import build_and_test_module
class Test(TestCase):
def test_enums(self):
build_and_test_module('enums')
def test_invalid_string_enum_member_value(self):
self.assert_transpile_raises(
'@enum\n'
'class Foo:\n'
' A =... | 31.546392 | 79 | 0.427288 | from .utils import TestCase
from .utils import build_and_test_module
class Test(TestCase):
def test_enums(self):
build_and_test_module('enums')
def test_invalid_string_enum_member_value(self):
self.assert_transpile_raises(
'@enum\n'
'class Foo:\n'
' A =... | true | true |
f71cc0cae73f084599395e8d8ba1c44ef7ba93fe | 1,764 | py | Python | LogFileSetup.py | skw32/DefectCorrectionsNotebook | 7342bc6cafa4c19c774d48c4f68b02db7d2e2eb1 | [
"BSD-3-Clause"
] | 4 | 2019-03-05T01:04:30.000Z | 2020-05-19T13:07:20.000Z | LogFileSetup.py | lxf-gzu/DefectCorrectionsNotebook | fef2ede0afb27e35d8e69c1d8aa759df284dc149 | [
"BSD-3-Clause"
] | 1 | 2019-06-01T18:07:53.000Z | 2019-06-01T18:07:53.000Z | LogFileSetup.py | lxf-gzu/DefectCorrectionsNotebook | fef2ede0afb27e35d8e69c1d8aa759df284dc149 | [
"BSD-3-Clause"
] | 6 | 2019-03-26T18:38:23.000Z | 2020-05-21T07:07:33.000Z | import logging
def configure_logging(logfile_path):
''' Initialize logging defaults for in-notebook messages and
'log.info' file written to store intermediate results during analysis of each defect
To use, the following lines must be added to the code:
import LogFileSetup as lfs
logg... | 46.421053 | 132 | 0.740363 | import logging
def configure_logging(logfile_path):
notebook_formatter = logging.Formatter("[%(levelname)s] [Cell line num: %(lineno)s] %(message)s")
defect_logger = logging.getLogger()
info_file_handler = logging.FileHandler(logfile_path + ".info", mode='w')
info_file_handler.s... | true | true |
f71cc1efb366d21efb50b72a9d38ce6d8c3b520d | 1,439 | py | Python | workers/clustering_worker/setup.py | hsh3n3/augur | bb65774a0884fd82ec7799f33ac87997268d5a5f | [
"MIT"
] | 1 | 2020-12-21T23:39:27.000Z | 2020-12-21T23:39:27.000Z | workers/clustering_worker/setup.py | hsh3n3/augur | bb65774a0884fd82ec7799f33ac87997268d5a5f | [
"MIT"
] | 2 | 2021-12-10T01:45:26.000Z | 2021-12-10T01:58:04.000Z | workers/clustering_worker/setup.py | hsh3n3/augur | bb65774a0884fd82ec7799f33ac87997268d5a5f | [
"MIT"
] | 1 | 2019-05-20T15:30:40.000Z | 2019-05-20T15:30:40.000Z | import io
import os
import re
from setuptools import find_packages
from setuptools import setup
def read(filename):
filename = os.path.join(os.path.dirname(__file__), filename)
text_type = type(u"")
with io.open(filename, mode="r", encoding='utf-8') as fd:
return re.sub(text_type(r':[a-z]+:`~?(.*?... | 28.78 | 94 | 0.579569 | import io
import os
import re
from setuptools import find_packages
from setuptools import setup
def read(filename):
filename = os.path.join(os.path.dirname(__file__), filename)
text_type = type(u"")
with io.open(filename, mode="r", encoding='utf-8') as fd:
return re.sub(text_type(r':[a-z]+:`~?(.*?... | true | true |
f71cc343a74ac1d719f7021173dac1e468df922f | 2,529 | py | Python | src/main/python/baselines/dsl/search/indexer.py | sgottsch/Tab2KG | 5c749ae6056a8c9b6a23674a7bf9d8a3cc7b8530 | [
"MIT"
] | null | null | null | src/main/python/baselines/dsl/search/indexer.py | sgottsch/Tab2KG | 5c749ae6056a8c9b6a23674a7bf9d8a3cc7b8530 | [
"MIT"
] | null | null | null | src/main/python/baselines/dsl/search/indexer.py | sgottsch/Tab2KG | 5c749ae6056a8c9b6a23674a7bf9d8a3cc7b8530 | [
"MIT"
] | null | null | null | # This is an edited version of https://github.com/minhptx/iswc-2016-semantic-labeling, which was edited to use it as a baseline for Tab2KG (https://github.com/sgottsch/Tab2KG).
import logging
from elasticsearch.exceptions import RequestError
from elasticsearch.helpers import scan, bulk
from lib.utils import get_index... | 35.125 | 176 | 0.572558 |
import logging
from elasticsearch.exceptions import RequestError
from elasticsearch.helpers import scan, bulk
from lib.utils import get_index_name
__author__ = "minh"
class Indexer:
def __init__(self, es):
self.es = es
def init_analyzers(self, index_config):
print("init_analyzers")
... | true | true |
f71cc3aaeaa11d3ebb6404eeec7169f405f64fce | 1,731 | py | Python | rkqc/tools/lnn_optimization.py | ah744/ScaffCC_RKQC | b7f9adb330f667c007ee9de6c3c1319c55ccc65b | [
"BSD-2-Clause"
] | 1 | 2022-02-05T23:28:35.000Z | 2022-02-05T23:28:35.000Z | rkqc/tools/lnn_optimization.py | ah744/ScaffCC_RKQC | b7f9adb330f667c007ee9de6c3c1319c55ccc65b | [
"BSD-2-Clause"
] | null | null | null | rkqc/tools/lnn_optimization.py | ah744/ScaffCC_RKQC | b7f9adb330f667c007ee9de6c3c1319c55ccc65b | [
"BSD-2-Clause"
] | 1 | 2022-02-05T23:42:06.000Z | 2022-02-05T23:42:06.000Z | #!/home/adam/Documents/revkit-1.3/python
#!/usr/bin/python
# RevKit: A Toolkit for Reversible Circuit Design (www.revkit.org)
# Copyright (C) 2009-2011 The RevKit Developers <revkit@informatik.uni-bremen.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gener... | 32.055556 | 122 | 0.740035 |
import sys , os
sys.path.append(os.path.dirname(sys.path[0]))
from revkit import *
opts = program_options()
opts.add_read_realization_option()
opts.add_write_realization_option()
opts.add_option( "reordering", 0, "0: Naive algorithm\n1: Local reordering\n2: Global reordering" )
opts.parse( sys.argv... | false | true |
f71cc45987d40f97d2107f51052d959e0ffc1f6c | 10,055 | py | Python | crawler/crawler.py | thelumberjhack/corpusgen | 8ff1045e5b884991903697e2567a2ba67f37060f | [
"MIT"
] | 2 | 2021-01-01T12:20:39.000Z | 2021-05-10T23:33:27.000Z | crawler/crawler.py | thelumberjhack/corpusgen | 8ff1045e5b884991903697e2567a2ba67f37060f | [
"MIT"
] | null | null | null | crawler/crawler.py | thelumberjhack/corpusgen | 8ff1045e5b884991903697e2567a2ba67f37060f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# This code greatly inspires itself from http://aosabook.org/en/500L/a-web-crawler-with-asyncio-coroutines.html
import cgi
from collections import namedtuple
import os
import re
import logging
import urllib
import asyncio
import aiohttp
from asyncio import Queue
import time
LOGGER = logging.get... | 30.014925 | 114 | 0.529687 |
import cgi
from collections import namedtuple
import os
import re
import logging
import urllib
import asyncio
import aiohttp
from asyncio import Queue
import time
LOGGER = logging.getLogger(__name__)
FetchStatistic = namedtuple(
'FetchStatistic', [
'url',
'next_url',
'status',
'... | true | true |
f71cc717d2a50c2a2eac3e063f01eef3d43d7dc5 | 1,914 | py | Python | code/venv/lib/python3.8/site-packages/datadog_api_client/v1/model/hourly_usage_attribution_response.py | Valisback/hiring-engineers | 7196915dd5a429ae27c21fa43d527f0332e662ed | [
"Apache-2.0"
] | null | null | null | code/venv/lib/python3.8/site-packages/datadog_api_client/v1/model/hourly_usage_attribution_response.py | Valisback/hiring-engineers | 7196915dd5a429ae27c21fa43d527f0332e662ed | [
"Apache-2.0"
] | null | null | null | code/venv/lib/python3.8/site-packages/datadog_api_client/v1/model/hourly_usage_attribution_response.py | Valisback/hiring-engineers | 7196915dd5a429ae27c21fa43d527f0332e662ed | [
"Apache-2.0"
] | null | null | null | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from datadog_api_client.v1.model_utils import (
ModelNormal,
cached_property,
... | 29.90625 | 108 | 0.698537 |
from datadog_api_client.v1.model_utils import (
ModelNormal,
cached_property,
)
def lazy_import():
from datadog_api_client.v1.model.hourly_usage_attribution_body import HourlyUsageAttributionBody
from datadog_api_client.v1.model.hourly_usage_attribution_metadata import HourlyUsageAttributionMetad... | true | true |
f71cc725c05458f3a9369d780bd91d3992785579 | 5,283 | py | Python | ecommerce/admin.py | Wassaf-Shahzad/micromasters | b1340a8c233499b1d8d22872a6bc1fe7f49fd323 | [
"BSD-3-Clause"
] | 32 | 2016-03-25T01:03:13.000Z | 2022-01-15T19:35:42.000Z | ecommerce/admin.py | Wassaf-Shahzad/micromasters | b1340a8c233499b1d8d22872a6bc1fe7f49fd323 | [
"BSD-3-Clause"
] | 4,858 | 2016-03-03T13:48:30.000Z | 2022-03-29T22:09:51.000Z | ecommerce/admin.py | umarmughal824/micromasters | ea92d3bcea9be4601150fc497302ddacc1161622 | [
"BSD-3-Clause"
] | 20 | 2016-08-18T22:07:44.000Z | 2021-11-15T13:35:35.000Z | """
Admin views for ecommerce models
"""
from django.contrib import admin
from ecommerce.models import (
Coupon,
CouponAudit,
CouponInvoice,
CouponInvoiceAudit,
Line,
Order,
OrderAudit,
Receipt,
RedeemedCoupon,
RedeemedCouponAudit,
UserCoupon,
UserCouponAudit,
)
from mi... | 25.157143 | 83 | 0.68692 |
from django.contrib import admin
from ecommerce.models import (
Coupon,
CouponAudit,
CouponInvoice,
CouponInvoiceAudit,
Line,
Order,
OrderAudit,
Receipt,
RedeemedCoupon,
RedeemedCouponAudit,
UserCoupon,
UserCouponAudit,
)
from micromasters.utils import get_field_names
... | true | true |
f71cc7626802c7caa73aac783baedbb65798da02 | 3,272 | py | Python | pylint_plugins/api_models.py | FairwindsOps/st2 | 2b76ca740c4af0d6b2c1d1ba5534ce4133fd16fa | [
"Apache-2.0"
] | 1 | 2021-04-08T03:21:49.000Z | 2021-04-08T03:21:49.000Z | pylint_plugins/api_models.py | FairwindsOps/st2 | 2b76ca740c4af0d6b2c1d1ba5534ce4133fd16fa | [
"Apache-2.0"
] | null | null | null | pylint_plugins/api_models.py | FairwindsOps/st2 | 2b76ca740c4af0d6b2c1d1ba5534ce4133fd16fa | [
"Apache-2.0"
] | null | null | null | # Licensed to the StackStorm, Inc ('StackStorm') 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 th... | 36.764045 | 98 | 0.663814 |
import six
from astroid import MANAGER
from astroid import nodes
from astroid import scoped_nodes
CLASS_NAME_BLACKLIST = [
'ExecutionSpecificationAPI'
]
def register(linter):
pass
def transform(cls):
if cls.name in CLASS_NAME_BLACKLIST:
return
if cls.name.endswith('API') ... | true | true |
f71cc7dd876392c1eb5462cd7fd83e0f8c22bec2 | 19,039 | py | Python | convlab2/policy/larl/multiwoz/latent_dialog/enc2dec/decoders.py | ljw23/ConvLab-2 | 13d48ea0e441701bd66100689b6c25b561f15525 | [
"Apache-2.0"
] | 339 | 2020-03-04T09:43:22.000Z | 2022-03-26T17:27:38.000Z | convlab2/policy/larl/multiwoz/latent_dialog/enc2dec/decoders.py | ljw23/ConvLab-2 | 13d48ea0e441701bd66100689b6c25b561f15525 | [
"Apache-2.0"
] | 122 | 2020-04-12T04:19:06.000Z | 2022-03-23T14:20:57.000Z | convlab2/policy/larl/multiwoz/latent_dialog/enc2dec/decoders.py | ljw23/ConvLab-2 | 13d48ea0e441701bd66100689b6c25b561f15525 | [
"Apache-2.0"
] | 138 | 2020-02-18T16:48:04.000Z | 2022-03-26T17:27:43.000Z | import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import numpy as np
from convlab2.policy.larl.multiwoz.latent_dialog.enc2dec.base_modules import BaseRNN
from convlab2.policy.larl.multiwoz.latent_dialog.utils import cast_type, LONG, ... | 43.270455 | 147 | 0.59625 | import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import numpy as np
from convlab2.policy.larl.multiwoz.latent_dialog.enc2dec.base_modules import BaseRNN
from convlab2.policy.larl.multiwoz.latent_dialog.utils import cast_type, LONG, ... | true | true |
f71cc8be7733ef8a045954aeb9adff342d2082ce | 8,657 | py | Python | src/diamond/handler/graphite.py | biancalana/Diamond | e044ec49f5bf1f70cb2c3ddffe38f347db7c9bce | [
"MIT"
] | 2 | 2016-10-24T02:51:32.000Z | 2021-01-09T20:49:44.000Z | src/diamond/handler/graphite.py | biancalana/Diamond | e044ec49f5bf1f70cb2c3ddffe38f347db7c9bce | [
"MIT"
] | 1 | 2016-04-06T00:00:35.000Z | 2016-04-06T00:00:35.000Z | src/diamond/handler/graphite.py | biancalana/Diamond | e044ec49f5bf1f70cb2c3ddffe38f347db7c9bce | [
"MIT"
] | 2 | 2016-05-12T08:01:52.000Z | 2016-05-16T20:39:47.000Z | # coding=utf-8
"""
Send metrics to a [graphite](http://graphite.wikidot.com/) using the default
interface.
Graphite is an enterprise-scale monitoring tool that runs well on cheap
hardware. It was originally designed and written by Chris Davis at Orbitz in
2006 as side project that ultimately grew to be a foundational... | 35.479508 | 90 | 0.541065 |
"""
Send metrics to a [graphite](http://graphite.wikidot.com/) using the default
interface.
Graphite is an enterprise-scale monitoring tool that runs well on cheap
hardware. It was originally designed and written by Chris Davis at Orbitz in
2006 as side project that ultimately grew to be a foundational monitoring to... | false | true |
f71cc8fe00c0b5c8796f9ec6ac11c85930433e40 | 4,318 | py | Python | WebMirror/management/UrlManage.py | awesome-archive/ReadableWebProxy | 360104694a21bc14c7756f29205c95823387e30b | [
"BSD-3-Clause"
] | 193 | 2016-08-02T22:04:35.000Z | 2022-03-09T20:45:41.000Z | WebMirror/management/UrlManage.py | awesome-archive/ReadableWebProxy | 360104694a21bc14c7756f29205c95823387e30b | [
"BSD-3-Clause"
] | 533 | 2016-08-23T20:48:23.000Z | 2022-03-28T15:55:13.000Z | WebMirror/management/UrlManage.py | awesome-archive/ReadableWebProxy | 360104694a21bc14c7756f29205c95823387e30b | [
"BSD-3-Clause"
] | 19 | 2015-08-13T18:01:08.000Z | 2021-07-12T17:13:09.000Z |
import calendar
import datetime
import json
import os
import os.path
import shutil
import tqdm
import traceback
from concurrent.futures import ThreadPoolExecutor
import urllib.error
import urllib.parse
from sqlalchemy import and_
from sqlalchemy import or_
import sqlalchemy.exc
if __name__ == "__main__":
import lo... | 23.988889 | 112 | 0.684576 |
import calendar
import datetime
import json
import os
import os.path
import shutil
import tqdm
import traceback
from concurrent.futures import ThreadPoolExecutor
import urllib.error
import urllib.parse
from sqlalchemy import and_
from sqlalchemy import or_
import sqlalchemy.exc
if __name__ == "__main__":
import lo... | true | true |
f71cc93f4fb121302f3d3b609755c636dc186814 | 53,235 | py | Python | zerver/views/message_fetch.py | CatarinaSMorais/zulip | e943d717b84291397328bd4dc578c04eed21885e | [
"Apache-2.0"
] | 1 | 2021-08-10T07:31:27.000Z | 2021-08-10T07:31:27.000Z | zerver/views/message_fetch.py | CatarinaSMorais/zulip | e943d717b84291397328bd4dc578c04eed21885e | [
"Apache-2.0"
] | 1 | 2021-08-05T14:46:02.000Z | 2021-08-05T14:46:02.000Z | zerver/views/message_fetch.py | CatarinaSMorais/zulip | e943d717b84291397328bd4dc578c04eed21885e | [
"Apache-2.0"
] | 1 | 2021-08-05T14:27:13.000Z | 2021-08-05T14:27:13.000Z | import re
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import orjson
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ValidationError
from django.db import connection
from django.http import HttpRequest,... | 39.057227 | 154 | 0.64544 | import re
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import orjson
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ValidationError
from django.db import connection
from django.http import HttpRequest,... | true | true |
f71ccbfa3508cc2de142272d5a5eb12f86208da2 | 2,165 | py | Python | Packs/FeedCyjax/Integrations/FeedCyjax/test_data/indicators.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/FeedCyjax/Integrations/FeedCyjax/test_data/indicators.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/FeedCyjax/Integrations/FeedCyjax/test_data/indicators.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | mocked_indicators = [
{
"type": "URL",
"industry_type": [
"IT",
"online gaming",
"Military"
],
"value": "https://test.domainos.com?test=true&id=32423",
"handling_condition": "GREEN",
"discovered_at": "2020-12-31T14:18:26+0000",
... | 32.313433 | 95 | 0.513164 | mocked_indicators = [
{
"type": "URL",
"industry_type": [
"IT",
"online gaming",
"Military"
],
"value": "https://test.domainos.com?test=true&id=32423",
"handling_condition": "GREEN",
"discovered_at": "2020-12-31T14:18:26+0000",
... | true | true |
f71ccc3dfa925bc05b65ff8afe4da56a24f1736f | 245 | py | Python | Python Programming/06. Classes/01-Classes.py | luckyrabbit85/Python | ed134fd70b4a7b84b183b87b85ad5190f54c9526 | [
"MIT"
] | 1 | 2021-07-15T18:40:26.000Z | 2021-07-15T18:40:26.000Z | Python Programming/06. Classes/01-Classes.py | luckyrabbit85/Python | ed134fd70b4a7b84b183b87b85ad5190f54c9526 | [
"MIT"
] | null | null | null | Python Programming/06. Classes/01-Classes.py | luckyrabbit85/Python | ed134fd70b4a7b84b183b87b85ad5190f54c9526 | [
"MIT"
] | null | null | null | # Class: blueprint for creating new objects
# Object: instances of a class
# Class: Human
# Objects: John, Mary, Jack
class Point:
def draw(self):
print("draw")
point = Point()
print(type(point))
print(isinstance(point, Point))
| 15.3125 | 43 | 0.677551 |
class Point:
def draw(self):
print("draw")
point = Point()
print(type(point))
print(isinstance(point, Point))
| true | true |
f71cccaab8c8334d17849d7af7fa89ed4b6eaf3b | 7,967 | py | Python | magnum/tests/unit/api/test_attr_validator.py | MatMaul/magnum | 4d5fd80d89e38e98aff24f01b967a57d0adcd191 | [
"Apache-2.0"
] | null | null | null | magnum/tests/unit/api/test_attr_validator.py | MatMaul/magnum | 4d5fd80d89e38e98aff24f01b967a57d0adcd191 | [
"Apache-2.0"
] | null | null | null | magnum/tests/unit/api/test_attr_validator.py | MatMaul/magnum | 4d5fd80d89e38e98aff24f01b967a57d0adcd191 | [
"Apache-2.0"
] | 1 | 2020-09-09T14:35:08.000Z | 2020-09-09T14:35:08.000Z | # Copyright 2015 EasyStack, 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 writ... | 46.319767 | 78 | 0.667629 |
from glanceclient import exc as glance_exception
import mock
from novaclient import exceptions as nova_exc
from magnum.api import attr_validator
from magnum.common import exception
from magnum.tests import base
class TestAttrValidator(base.BaseTestCase):
def test_validate_flavor_with_vaild_flavor... | true | true |
f71ccd96515f76c1d80e0d8132600385ef3f08bf | 3,311 | py | Python | huaweicloud-sdk-osm/huaweicloudsdkosm/v2/model/list_case_labels_response.py | huaweicloud/huaweicloud-sdk-python-v3 | 7a6270390fcbf192b3882bf763e7016e6026ef78 | [
"Apache-2.0"
] | 64 | 2020-06-12T07:05:07.000Z | 2022-03-30T03:32:50.000Z | huaweicloud-sdk-osm/huaweicloudsdkosm/v2/model/list_case_labels_response.py | huaweicloud/huaweicloud-sdk-python-v3 | 7a6270390fcbf192b3882bf763e7016e6026ef78 | [
"Apache-2.0"
] | 11 | 2020-07-06T07:56:54.000Z | 2022-01-11T11:14:40.000Z | huaweicloud-sdk-osm/huaweicloudsdkosm/v2/model/list_case_labels_response.py | huaweicloud/huaweicloud-sdk-python-v3 | 7a6270390fcbf192b3882bf763e7016e6026ef78 | [
"Apache-2.0"
] | 24 | 2020-06-08T11:42:13.000Z | 2022-03-04T06:44:08.000Z | # coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ListCaseLabelsResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... | 28.791304 | 83 | 0.583812 |
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ListCaseLabelsResponse(SdkResponse):
sensitive_list = []
openapi_types = {
'case_label_list': 'list[CaseLabelInfo]'
}
attribute... | true | true |
f71cce801e6baa714b9a75a9300c23ab0372565e | 21,083 | py | Python | deepfence_backend/tasks/task_scheduler.py | Jramirezg/ThreatMapper | af5fda3ff585f8728a7a0b48ae6818ed189e4dbf | [
"Apache-2.0"
] | null | null | null | deepfence_backend/tasks/task_scheduler.py | Jramirezg/ThreatMapper | af5fda3ff585f8728a7a0b48ae6818ed189e4dbf | [
"Apache-2.0"
] | null | null | null | deepfence_backend/tasks/task_scheduler.py | Jramirezg/ThreatMapper | af5fda3ff585f8728a7a0b48ae6818ed189e4dbf | [
"Apache-2.0"
] | null | null | null | import arrow
from config.app import celery_app, app
from models.container_image_registry import RegistryCredential
from models.scheduler import Scheduler
from models.setting import Setting
from croniter import croniter
from utils import constants
import time
from datetime import datetime
from utils.helper import websoc... | 61.287791 | 129 | 0.538206 | import arrow
from config.app import celery_app, app
from models.container_image_registry import RegistryCredential
from models.scheduler import Scheduler
from models.setting import Setting
from croniter import croniter
from utils import constants
import time
from datetime import datetime
from utils.helper import websoc... | true | true |
f71ccea17261d0989d135fd953f856682a8dd848 | 1,284 | py | Python | python-2-apps/fn_bluecoat_recategorization/setup.py | JayDi11a/Geralds-IBM-SOAR-Integrations | 0e0eb18adbaf3a266e1dc5a316df7cd5a93f88d0 | [
"MIT"
] | null | null | null | python-2-apps/fn_bluecoat_recategorization/setup.py | JayDi11a/Geralds-IBM-SOAR-Integrations | 0e0eb18adbaf3a266e1dc5a316df7cd5a93f88d0 | [
"MIT"
] | 1 | 2022-03-06T00:10:13.000Z | 2022-03-06T00:10:13.000Z | python-2-apps/fn_bluecoat_recategorization/setup.py | JayDi11a/Geralds-IBM-SOAR-Integrations | 0e0eb18adbaf3a266e1dc5a316df7cd5a93f88d0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='fn_bluecoat_recategorization',
version='1.0.0',
license='<<insert here>>',
author='<<your name here>>',
author_email='you@example.com',
url='<<your company url>>',
description="Resilient ... | 40.125 | 163 | 0.719626 |
from setuptools import setup, find_packages
setup(
name='fn_bluecoat_recategorization',
version='1.0.0',
license='<<insert here>>',
author='<<your name here>>',
author_email='you@example.com',
url='<<your company url>>',
description="Resilient Circuits Components for 'fn_bluecoat_recateg... | true | true |
f71ccec79ef122b387b104a8ce307bf488b1bd1c | 15,996 | py | Python | src/auxil/eeMad_run.py | mortcanty/EESARDocker | 855b41a3da19f3b07b42438784309ab48fc7fe98 | [
"MIT"
] | 23 | 2018-11-11T02:43:42.000Z | 2021-08-21T21:53:19.000Z | src/auxil/eeMad_run.py | mortcanty/EESARDocker | 855b41a3da19f3b07b42438784309ab48fc7fe98 | [
"MIT"
] | 8 | 2020-03-24T16:25:42.000Z | 2021-08-23T20:35:38.000Z | src/auxil/eeMad_run.py | mortcanty/EESARDocker | 855b41a3da19f3b07b42438784309ab48fc7fe98 | [
"MIT"
] | 8 | 2019-12-20T13:33:47.000Z | 2021-10-24T02:18:37.000Z | '''
Created on 08.04.2019
@author: mort
ipywidget interface to the GEE for IR-MAD
'''
import ee, time, warnings, math
import ipywidgets as widgets
from IPython.display import display
from ipyleaflet import (Map,DrawControl,TileLayer,
basemaps,basemap_to_tiles,
LayersCo... | 42.429708 | 157 | 0.582146 | import ee, time, warnings, math
import ipywidgets as widgets
from IPython.display import display
from ipyleaflet import (Map,DrawControl,TileLayer,
basemaps,basemap_to_tiles,
LayersControl,
MeasureControl,
FullScreenControl)... | true | true |
f71ccf566a61303c7989a45da65942c1b7aef635 | 10,678 | py | Python | examples/scales/step1.py | KNPSystem/server | 85aa991cf86b10330054bd8ea4a12543851cb9fc | [
"MIT"
] | null | null | null | examples/scales/step1.py | KNPSystem/server | 85aa991cf86b10330054bd8ea4a12543851cb9fc | [
"MIT"
] | null | null | null | examples/scales/step1.py | KNPSystem/server | 85aa991cf86b10330054bd8ea4a12543851cb9fc | [
"MIT"
] | null | null | null | """
Get the data from covidtracking.com.
Store it in a knpsValue.
Assign to a knpsVariable.
Everytime we run this, the knpsVariable is not changed.
But the knpsValue it points to should be updated.
i.e. a new knpsValue is created.
"""
import requests
import json
from collections import defaultdict
from datetime import ... | 34.445161 | 138 | 0.613879 | import requests
import json
from collections import defaultdict
from datetime import datetime, timedelta
from urllib.request import urlopen
from lib import get_user_id, create_data_object, update_data_object
USER_NAME = "Mike Anderson"
USER_EMAIL = "mrander@umich.edu"
sample_data_file = "data/Unemployment_data_2019.... | true | true |
f71ccf5e40a5d9802ed0c6e2043dda4342fb9258 | 391 | py | Python | serveup/wsgi.py | ASquirrelsTail/serve-up | 9533ba82f5b4989434b3b20352d17a8131bb9619 | [
"MIT"
] | null | null | null | serveup/wsgi.py | ASquirrelsTail/serve-up | 9533ba82f5b4989434b3b20352d17a8131bb9619 | [
"MIT"
] | 10 | 2021-03-30T14:05:21.000Z | 2022-03-12T00:41:15.000Z | serveup/wsgi.py | ASquirrelsTail/serve-up | 9533ba82f5b4989434b3b20352d17a8131bb9619 | [
"MIT"
] | null | null | null | """
WSGI config for serveup project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTI... | 23 | 78 | 0.785166 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'serveup.settings')
application = get_wsgi_application()
| true | true |
f71ccfaa61b4b5f0ebf12cbfe2ca50b9ddc66c78 | 417 | py | Python | pypy/rlib/test/test_rgc.py | camillobruni/pygirl | ddbd442d53061d6ff4af831c1eab153bcc771b5a | [
"MIT"
] | 12 | 2016-01-06T07:10:28.000Z | 2021-05-13T23:02:02.000Z | pypy/rlib/test/test_rgc.py | camillobruni/pygirl | ddbd442d53061d6ff4af831c1eab153bcc771b5a | [
"MIT"
] | null | null | null | pypy/rlib/test/test_rgc.py | camillobruni/pygirl | ddbd442d53061d6ff4af831c1eab153bcc771b5a | [
"MIT"
] | 2 | 2016-07-29T07:09:50.000Z | 2016-10-16T08:50:26.000Z | from pypy.rpython.test.test_llinterp import gengraph, interpret
from pypy.rlib import rgc # Force registration of gc.collect
import gc
def test_collect():
def f():
return gc.collect()
t, typer, graph = gengraph(f, [])
ops = list(graph.iterblockops())
assert len(ops) == 1
op = ops[0][1]
... | 20.85 | 63 | 0.630695 | from pypy.rpython.test.test_llinterp import gengraph, interpret
from pypy.rlib import rgc
import gc
def test_collect():
def f():
return gc.collect()
t, typer, graph = gengraph(f, [])
ops = list(graph.iterblockops())
assert len(ops) == 1
op = ops[0][1]
assert op.opname == 'gc__collect'... | true | true |
f71cd18cea2ada57b893164f00c100b5a386de43 | 3,792 | py | Python | test/core_arguments.py | sdarwin/build | 2c4217ebb6bdeb5001b33a5d0d6718420aef988c | [
"BSL-1.0"
] | 106 | 2015-08-07T04:23:50.000Z | 2020-12-27T18:25:15.000Z | test/core_arguments.py | sdarwin/build | 2c4217ebb6bdeb5001b33a5d0d6718420aef988c | [
"BSL-1.0"
] | 130 | 2016-06-22T22:11:25.000Z | 2020-11-29T20:24:09.000Z | test/core_arguments.py | sdarwin/build | 2c4217ebb6bdeb5001b33a5d0d6718420aef988c | [
"BSL-1.0"
] | 41 | 2015-07-08T19:18:35.000Z | 2021-01-14T16:39:56.000Z | #!/usr/bin/python
# Copyright 2001 Dave Abrahams
# Copyright 2011 Steven Watanabe
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
import BoostBuild
def simple_args(start, finish):
return " : ".join("%d" % x fo... | 36.461538 | 79 | 0.474947 |
import BoostBuild
def simple_args(start, finish):
return " : ".join("%d" % x for x in range(start, finish + 1))
def test(t, type, input, output, status=0):
code = ["include echo_args.jam ; echo_%s" % type]
if input: code.append(input)
code.append(";")
t.write("file.jam", " ".join(code))
... | true | true |
f71cd1ac7f84132149ddc09f332427ff7a78ff75 | 2,799 | py | Python | python/group_merger.py | CSCI5470/testing-alexjohnny1207 | 36ab3fa0cd7d32e27b167a985f9d47991d690fce | [
"MIT"
] | 414 | 2016-06-28T16:24:47.000Z | 2022-03-25T13:30:27.000Z | python/group_merger.py | CSCI5470/testing-alexjohnny1207 | 36ab3fa0cd7d32e27b167a985f9d47991d690fce | [
"MIT"
] | 35 | 2017-03-07T16:36:20.000Z | 2021-07-18T04:53:41.000Z | python/group_merger.py | CSCI5470/testing-alexjohnny1207 | 36ab3fa0cd7d32e27b167a985f9d47991d690fce | [
"MIT"
] | 162 | 2016-02-08T21:58:19.000Z | 2022-02-16T09:40:11.000Z | import caffe
import re
from pittnuts import *
import os
import matplotlib.pyplot as plt
import argparse
import caffeparser
import caffe_apps
import numpy as np
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--original_alexnet', type=str, required=True,help="The original alex... | 41.776119 | 161 | 0.673455 | import caffe
import re
from pittnuts import *
import os
import matplotlib.pyplot as plt
import argparse
import caffeparser
import caffe_apps
import numpy as np
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--original_alexnet', type=str, required=True,help="The original alex... | false | true |
f71cd2549c8bf4f50eefa40b961f15351236ec5b | 350 | py | Python | openctrl/display.py | openctrl-python/openctrl | 5adda5d79262950eceab91b8412ead3d3a13e712 | [
"MIT"
] | null | null | null | openctrl/display.py | openctrl-python/openctrl | 5adda5d79262950eceab91b8412ead3d3a13e712 | [
"MIT"
] | 1 | 2021-06-02T18:59:19.000Z | 2021-06-02T18:59:19.000Z | openctrl/display.py | pyopencontrol/openctrl | 24f08970052301cb0c4a13fc855b80353a3cb975 | [
"MIT"
] | null | null | null | import threading
try:
from .grab import Image
except:pass
def grab_bytes():
return Image().asbytes
def send(s,a):
s.post(b's'+grab_bytes(),a)
def show_bytes(r):
if not r.startswith('s'):return
Image(r[1:]).show()
def conf(s,a):
def _conf():
while True:
send(s,a)
threading... | 20.588235 | 42 | 0.617143 | import threading
try:
from .grab import Image
except:pass
def grab_bytes():
return Image().asbytes
def send(s,a):
s.post(b's'+grab_bytes(),a)
def show_bytes(r):
if not r.startswith('s'):return
Image(r[1:]).show()
def conf(s,a):
def _conf():
while True:
send(s,a)
threading... | true | true |
f71cd2c0ab36287199c78e7dfc110494800caf19 | 8,955 | py | Python | test_pretrain.py | anonymous-cv/cvpr-sub | 6307520c73716de73ef63f5239bdac8dda20da41 | [
"BSD-3-Clause"
] | null | null | null | test_pretrain.py | anonymous-cv/cvpr-sub | 6307520c73716de73ef63f5239bdac8dda20da41 | [
"BSD-3-Clause"
] | null | null | null | test_pretrain.py | anonymous-cv/cvpr-sub | 6307520c73716de73ef63f5239bdac8dda20da41 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import time
import argparse
import sys
import numpy as np
import torch
import torch.optim as optim
from tqdm import tqdm
from network.BEV_Unet import BEV_Unet
from network.ptBEV import ptBEVnet
from dataloader.dataset import collate_fn_BEV,collate_fn_BEV_test,Se... | 46.884817 | 166 | 0.656505 |
import os
import time
import argparse
import sys
import numpy as np
import torch
import torch.optim as optim
from tqdm import tqdm
from network.BEV_Unet import BEV_Unet
from network.ptBEV import ptBEVnet
from dataloader.dataset import collate_fn_BEV,collate_fn_BEV_test,SemKITTI,SemKITTI_label_name,spherical_dataset,... | true | true |
f71cd34ea15347fc0a22c67ddefbd517bbd2ed66 | 101 | py | Python | src/ytdl/playlists/models/__init__.py | Asday/ytdl | 96a51ba3589e855b27f75095b0cd4a6f00f8eefa | [
"MIT"
] | null | null | null | src/ytdl/playlists/models/__init__.py | Asday/ytdl | 96a51ba3589e855b27f75095b0cd4a6f00f8eefa | [
"MIT"
] | 1 | 2019-04-15T02:09:37.000Z | 2019-04-15T02:09:37.000Z | src/ytdl/playlists/models/__init__.py | Asday/ytdl | 96a51ba3589e855b27f75095b0cd4a6f00f8eefa | [
"MIT"
] | null | null | null | from .playlist import Playlist
from .video import Video
__all__ = [
'Playlist',
'Video',
]
| 11.222222 | 30 | 0.653465 | from .playlist import Playlist
from .video import Video
__all__ = [
'Playlist',
'Video',
]
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.