id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3206658 | <filename>OMMADE/Validations/_Main_WSADECompare.py
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 17 11:51:16 2017
@author: <NAME> & <NAME>
Main Program to validate transport in two mobile zones without exchange
Input files are in the Comparison_WSADE directory
"""
import numpy as np
import matplotlib.py... | StarcoderdataPython |
95523 | from openpharmacophore import Pharmacophore, StructuredBasedPharmacophore, LigandBasedPharmacophore
from openpharmacophore._private_tools.exceptions import OpenPharmacophoreNotImplementedError, OpenPharmacophoreValueError
def is_3d_pharmacophore(pharmacophore):
""" Check whether a pharmacophore object is of type P... | StarcoderdataPython |
3254122 | import numpy
import pandas
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, Dataset, TensorDataset
device = 'cuda' if torch.cuda.is_available() else 'cpu'
train_dataset = torchvision.datasets.FashionMNIST(root='dataset', train=True,
... | StarcoderdataPython |
4825110 | <reponame>casbin/openstack-patron<filename>patron-test/patron-python-api-test.py
#Add by <NAME>
"""
Used to test Patron API's verify method.
"""
from patronclient import client
import socket
if socket.gethostname() == "controller":
VERSION = "2"
USERNAME = "admin"
PASSWORD = "<PASSWORD>"
PROJECT_ID ... | StarcoderdataPython |
3304941 | <gh_stars>0
from dask.bag.core import split
from dask.dataframe.core import new_dd_object, split_evenly
from dask.base import tokenize
from dask.highlevelgraph import HighLevelGraph
import numpy as np
import dask.dataframe as dd
from dask.dataframe.io.io import sorted_division_locations
import operator
from dask.bag im... | StarcoderdataPython |
3215004 | # coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.3192
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Quote(object):
"""NOTE: This class is auto generated by ... | StarcoderdataPython |
1721538 | def make(*args, **kargs):
from .app import App
return App(__name__, *args, **kargs)
| StarcoderdataPython |
14172 | import multiprocessing as mp
import os
import shutil
from functools import partial
from tqdm import tqdm
import data
from chemhelp import mndo
# def calculate(binary, filename, scr=None):
# """
# Collect sets of lines for each molecule as they become available
# and then call a parser to extract the dict... | StarcoderdataPython |
60376 | <reponame>v-adhithyan/itunes-controller
import os
import random
import sys
import cv2
import argparse
path = os.path.abspath(os.path.dirname(__file__))
def capture_pic():
cam = cv2.VideoCapture(0)
captured, img = cam.read()
#cam.release()
if captured:
return img
else:
return None
... | StarcoderdataPython |
1720364 | <reponame>extremenelson/sirius<filename>lucida/commandcenter/controllers/ConfigChecker.py
from Config import *
# Check Config.py.
if MAX_DOC_NUM_PER_USER <= 0:
print 'MAX_DOC_NUM_PER_USER must be non-negative'
exit()
if not (TRAIN_OR_LOAD == 'train' or TRAIN_OR_LOAD == 'load'):
print 'TRAIN_OR_LOAD must be either t... | StarcoderdataPython |
3395332 | """The auto-rebuild system is an optional part of webassets that can be used
during development, and can also be quite convenient on small sites that don't
have the performance requirements where a rebuild-check on every request is
fatal.
This module contains classes that help determine whether a rebuild is required
f... | StarcoderdataPython |
148707 | import numpy as np
import unittest
from monte_carlo_tree_search import Node, MCTS, ucb_score
from game import Connect2Game
class MCTSTests(unittest.TestCase):
def test_mcts_from_root_with_equal_priors(self):
class MockModel:
def predict(self, board):
# starting board is:
... | StarcoderdataPython |
3204086 | <filename>python/misc/valid_bst.py
class node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def checkBST(root):
return isBST(root, None, None)
def isBST(x, minNode, maxNode):
if x is None:
return True
if minNode and x.data <= mi... | StarcoderdataPython |
25687 | <filename>ebi_eva_common_pyutils/variation/contig_utils.py
# Copyright 2020 EMBL - European Bioinformatics Institute
#
# 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... | StarcoderdataPython |
3354511 | <gh_stars>0
# coding: utf-8
# # Klassifikation der in gensim vektorisierten Daten (all_labels)
#
# Autorin: <NAME>
# In[1]:
# Imports
import os
import time
import pandas as pd
import numpy as np
import scipy.sparse
from matplotlib import pyplot
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.m... | StarcoderdataPython |
1765963 | <filename>tests/chart_tests/test_prometheus_node_exporter.py
from tests.chart_tests.helm_template_generator import render_chart
import pytest
from tests import supported_k8s_versions, get_containers_by_name
@pytest.mark.parametrize(
"kube_version",
supported_k8s_versions,
)
class TestPrometheusNodeExporterDae... | StarcoderdataPython |
3251829 | <gh_stars>0
from django.urls import path
from .views import RegisterView,VerifyEmail
urlpatterns = [
path('register/',RegisterView.as_view(), name="register"),
path('email-verify/',VerifyEmail.as_view(), name="email-verify"),
]
| StarcoderdataPython |
161509 | from .classical_storage import ClassicalStorage
from .logger import Logger
from .message import Message
from .packet import Packet
from .quantum_storage import QuantumStorage
from .qubit import Qubit
from .quantum_connection import Q_Connection
from .classical_connection import C_Connection
from .routing_packet import ... | StarcoderdataPython |
135176 | #!/usr/bin/python3
# Generate an intent schema file by asking questions.
from __future__ import print_function
import json
import readline
import os
from .config import config
read_in = config.read_in
intent_schema_path = config.DEFAULT_INTENT_SCHEMA_LOCATION
empty_schema = """{"intents": []}"""
slot_type_mapping... | StarcoderdataPython |
16999 | from django.urls import path
from . import views
from .views import IndexView
urlpatterns = [
# path('', views.index, name="index"),
path('', IndexView.as_view(), name="index"),
# path('create/', views.create, name="create"),
path('create/', views.PythonCreateView.as_view(), name="create"),
] | StarcoderdataPython |
160191 | #!/usr/bin/env python
"""
Test module for linear boundary value problems (serial)
This module solves equations of the form
.. _math::
\nabla \cdot \left( a(x) \nabla u \right) = f(x)
"""
import pytest
from proteus.iproteus import *
from proteus import Comm
comm = Comm.get()
import poisson_3d_tetgen_p
import poiss... | StarcoderdataPython |
3339440 | <reponame>v1259397/cosmic-gnuradio
#!/usr/bin/env python
#
# Copyright 2012-2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; ... | StarcoderdataPython |
1767510 | import random
from gennav.utils.geometry import Point
def uniform_adjustable_random_sampler(sample_area, goal, goal_sample_rate):
"""Randomly sample point in area while sampling goal point
at a specified rate.
Args:
sample_area(tuple): area to sample point in (min and max)
... | StarcoderdataPython |
194160 | <reponame>jdj2261/joystick-test
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@ Created Date: May 15. 2020
@ Updated Date: May 4. 2021
@ Author: <NAME>
@ Description: Serial Communication
'''
import time
import sys, os
import serial, serial.tools.list_ports
from serial.serialutil import SerialException
dir_path... | StarcoderdataPython |
3249975 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayMerchantPayforprivilegeMemberremainingQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayMerchantPayforprivilegeMemb... | StarcoderdataPython |
1615267 | <reponame>Xiangyan93/mstools
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .slurm import Slurm
__all__ = [Slurm]
| StarcoderdataPython |
1690978 | <reponame>to-aoki/my-pytorch-bert
# coding=utf-8
#
# Author <NAME>
# This file is based on
# https://github.com/huggingface/pytorch-pretrained-BERT/blob/master/examples/run_lm_finetuning.py.
# This uses the part of BERTDataset.
#
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# Copyr... | StarcoderdataPython |
1739496 | '''
Created on june 12, 2018
author: Edmond
'''
from __future__ import print_function, division, absolute_import, unicode_literals
import os
import shutil
import numpy as np
from collections import OrderedDict
import logging
from time import time
import tensorflow as tf
import util
from layers import (weight_variabl... | StarcoderdataPython |
1600331 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from collections import OrderedDict
import re
import string
def lexical(token):
"""
Extract lexical features from given token
T... | StarcoderdataPython |
37670 | import os
"""
# If you have multi-gpu, designate the number of GPU to use.
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
"""
import argparse
import logging
from tqdm import tqdm # progress bar
import numpy as np
import matplotlib.pyplot as plt
from keras import optimizers
from... | StarcoderdataPython |
3292250 | <filename>h5netcdf/legacyapi.py
import sys
import h5py
import numpy as np
from . import core
def _check_return_dtype_endianess(endian="native"):
little_endian = sys.byteorder == "little"
endianess = "="
if endian == "little":
endianess = little_endian and endianess or "<"
elif endian == "big... | StarcoderdataPython |
1772000 | import importlib
import inspect
import os
import pathlib
import sys
from functools import partial
from itertools import chain
from typing import Generator, Optional, Tuple, Type
from xappt.constants import *
from xappt.config import log as logger
from xappt.models import BaseTool, BaseInterface
from xappt.models.plug... | StarcoderdataPython |
1682874 | <gh_stars>0
binary1 = {0:'0000', 1:'0001', 2:'0010', 3:'0011', 4:'0100', 5:'0101', 6:'0110', 7:'0111', 8:'1000',
9:'1001', 10:'1010', 11:'1011', 12:'1100', 13:'1101', 14:'1110', 15:'1111'}
binary = {'0':'0000', '1':'0001', '2':'0010', '3':'0011', '4':'0100', '5':'0101', '6':'0110', '7':'0111',
'8':'1000', '9':'1001', '... | StarcoderdataPython |
4817949 | # import cs50 functionality
from cs50 import get_float
# prompt user for positive real number
while True:
cash = get_float("Change owed: ")
if cash > 0:
break
# changes and rounds the float value to integer value
n = int((cash * 100) + 0.5)
# loop for counting no. of coins
counter = 0
while n >= 25:
... | StarcoderdataPython |
1616401 | import json
def save_data(filename, key_list, value_list):
dic = dict(list(zip(key_list, value_list)))
target = open(filename, 'w')
target.write(json.dumps(dic))
target.close() | StarcoderdataPython |
18537 | # 2022 eCTF
# Bootloader Interface Emulator
# <NAME>
#
# (c) 2022 The MITRE Corporation
#
# This source file is part of an example system for MITRE's 2022 Embedded System
# CTF (eCTF). This code is being provided only for educational purposes for the
# 2022 MITRE eCTF competition, and may not meet MITRE standards for q... | StarcoderdataPython |
3302033 | from setuptools import setup, find_packages
setup(
name="been",
description="A life stream collector.",
version="0.1",
author="<NAME>",
author_email="<EMAIL>",
keywords="feed lifestream",
license="BSD",
classifiers=[
"Programming Language :: Python",
"Topic :: Internet :... | StarcoderdataPython |
196250 | <reponame>edupyter/EDUPYTER38<filename>Lib/site-packages/notebook/tests/conftest.py<gh_stars>0
def pytest_addoption(parser):
parser.addoption('--integration_tests', action='store_true', dest="integration_tests",
default=False, help="enable integration tests")
def pytest_configure(config):
if n... | StarcoderdataPython |
68457 | <reponame>chiarasharp/py3DViewer<gh_stars>0
import numpy as np
from .ObservableArray import *
import copy
def read_mesh(filename):
"""
Imports the data from the given .mesh file
Parameters:
filename (string): The name of the .mesh file
Return:
(Array, Array, Array): The mesh vertic... | StarcoderdataPython |
66740 | <filename>lib/googlecloudsdk/third_party/apis/metastore/v1beta/metastore_v1beta_messages.py
"""Generated message classes for metastore version v1beta.
The Dataproc Metastore API is used to manage the lifecycle and configuration
of metastore services.
"""
# NOTE: This file is autogenerated and should not be edited by h... | StarcoderdataPython |
4811751 | <gh_stars>10-100
from toee import *
import char_editor
def CheckPrereq(attachee, classLeveled, abilityScoreRaised):
if not char_editor.has_feat(feat_shield_proficiency):
return 0
if not char_editor.has_feat(feat_combat_casting):
return 0
concentration_level = char_editor.skill_ranks_get(skill_concentratio... | StarcoderdataPython |
1633981 | <reponame>MD-Studio/cerise-mdstudio-mock
#!/usr/bin/env python3
import json
import os
from pathlib import Path
import shutil
import sys
# get directories
this_dir = Path(__file__).parent
data_dir = this_dir / 'dummy_data'
work_dir = Path(os.getcwd())
# copy dummy output in place
dummy_data = {
'gromitout': ... | StarcoderdataPython |
1775709 | "entry point module"
import json
import pathlib
from typing import Tuple
import click
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from msi_zarr_analysis.ml.dataset.cytomine_ms_overlay import (
CytomineTranslated,
CytomineTranslatedProgressiveBinningFactory... | StarcoderdataPython |
3394650 | from distutils.core import setup
import setuptools
dependencies=[
"setuptools~=57.0.0",
"aiohttp~=3.7.4",
"PyYAML~=5.4.1",
]
setup(
name="chiahub_monitor",
version="0.0.5",
author="<NAME>",
author_email="<EMAIL>",
description="A monitoring utility for chia blockchain",
long_descri... | StarcoderdataPython |
1747674 | # -*- coding: utf-8 -*-
# Copyright 2015 <NAME>. 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. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" f... | StarcoderdataPython |
3318921 | <filename>preprocessor/fce.py
import nltk
from pathlib import Path
from typing import List, Tuple
from lxml import etree
from .base import DatasetPreprocessor
class FCEPreprocessor(DatasetPreprocessor):
def __init__(self, dataset_path: Path):
"""
Initializes preprocessor for FCE dataset (https://i... | StarcoderdataPython |
3202823 | #-*- coding: utf-8 -*-
from task import TaskInfoFactory
from fab import getFab
from user import getUsers, CacheUsers, UserInfo
import sys, argparse
from diagnosis.printers import Banner
from diagnosis.debugTools import runcmd
from prettyprint import pp as ppr
argsParser = argparse.ArgumentParser()
argsParser.add_arg... | StarcoderdataPython |
58091 | from dataclasses import dataclass
from bindings.gmd.multi_point_coverage_type import MultiPointCoverageType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class MultiPointCoverage(MultiPointCoverageType):
"""In a gml:MultiPointCoverage the domain set is a gml:MultiPoint, that is
a collection of arbi... | StarcoderdataPython |
193239 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import re
import time
import os
from sklearn.svm import SVR
import joblib
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit_utils import smiles_dataset
from utils import save_dataset
model_load = joblib.load('./models... | StarcoderdataPython |
3238543 | <reponame>iancovert/shapley-regression
import setuptools
setuptools.setup(
name="shapley-regression",
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
description="For estimating Shapley values via linear regression.",
long_description="""
For calculating the Shapley values of ... | StarcoderdataPython |
35818 | <gh_stars>0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import pandas as pd
url_list = []
title_list = []
summary_list = []
date_list = []
# source_list = []
url = 'https://edition.cnn.com/search?size=30&q=terror&sort=newest'
# keyword_list = ['terror']
# ... | StarcoderdataPython |
3305987 | # 100-pin MachXO2-640 or -1200 chip
# 78 GPIOs or 39 differential I/O
# 8 VCCIO, 2 VCC, 8 GND, 3 NC, 4 jtag, 4-5 random config pins
# That leaves 70 actual GPIOs
# Lattice says:
# Pull up PROGRAMN (to avoid accidental entry into programming mode)
# Pull up INITN (in programming doc but not hw checklist)
# Pull up DONE... | StarcoderdataPython |
172381 | <reponame>j4s0n/FirmWire<filename>firmwire/vendor/mtk/mtkdb/parse_mdb.py
## Copyright (c) 2022, Team FirmWire
## SPDX-License-Identifier: BSD-3-Clause
import struct
import lzma
import logging
log = logging.getLogger(__name__)
def reads32(f):
x = f.read(4)
return struct.unpack("<i", x)[0]
def read32(f):
... | StarcoderdataPython |
119626 | import os.path
from pathlib import Path
from inspect import signature
import torch
import numpy as np
__all__ = [
"Callback",
"ModelSaver",
"Logger",
"EarlyStopping",
"VarianceBasedEarlyStopping",
"MetricEvaluator"
]
class Callback:
"""Base class for callbacks."""
def on_train_star... | StarcoderdataPython |
3288682 | import unittest
from app.models import Articles
class ArticleTest(unittest.TestCase):
"""
Test Article class to test behaviours of the Article class
Args:
Unittest.TestCase: Test case class that helps create test cases
"""
def setUp(self):
"""
Set up method to run befo... | StarcoderdataPython |
1770519 | #!/usr/bin/env python3
# If using pip, this enables, for example, `pip install -v -e .`
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="paintbyword",
version="0.0.1",
author="<NAME>, <NAME>",
author_email="<EMAIL>",
description="Paint... | StarcoderdataPython |
3340096 | <filename>musictree/MyTestSuite/test_1b_chromatic_up_1.py
from pathlib import Path
from unittest import TestCase
from musictree.accidental import Accidental
from musictree.chord import Chord
from musictree.measure import generate_measures
from musictree.midi import Midi
from musictree.part import Part
from musictree.s... | StarcoderdataPython |
3359028 | # 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 ... | StarcoderdataPython |
1716710 | <gh_stars>0
# -*- coding: utf-8 -*-
import os
import re
def moveEnMessage(file1, file2, language):
with open(file2, 'r') as r2:
newText = r2.read()
with open(file1, 'r') as r:
textList = r.readlines()
for text in textList:
text = text.strip('\n')
if re.match('^(... | StarcoderdataPython |
129967 | # Copyright 2015 <NAME> (www.waynedgrant.com)
# Licensed under the MIT License
from decimal import *
from units import PressureUnit
from units import RainfallUnit
from units import TemperatureUnit
from units import WindDirectionUnit
from units import WindSpeedUnit
def setup_decimal_context(context):
context.prec... | StarcoderdataPython |
3375155 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The database model for an "Anomaly", which represents a step up or down."""
import sys
from google.appengine.ext import ndb
from dashboard.models impor... | StarcoderdataPython |
62411 | """
Routes here:
- Where am I ?
- Return the street, city and country a given geolocation point is at.
- Linear distance (Haversine)
- Return the linear distance on a globe given two geo-coordinates.
"""
from fastapi import APIRouter
from src.service.HaversineService import linear_distance
from src.model.l... | StarcoderdataPython |
1637699 | <reponame>swaroop9ai9/problemsolving<filename>e_gcd.py
def egcd(m,n):
#Assume m>n
if n>m:
(m,n)=(n,m)
if m%n==0:
return str(n)
else:
diff=m-n
return(egcd(max(n,diff),min(n,diff)))
print(egcd(int(input('Number 1\n')),int(input('Number 2\n'))))
| StarcoderdataPython |
4808440 | """Customizations to Django Taggit."""
from allauth.socialaccount.models import SocialApp
from django.db.models import Count
from django.utils.text import slugify
import requests
from taggit.models import Tag
from taggit.utils import _parse_tags
from .constants import GITHUB_REGEXS
def rtd_parse_tags(tag_string):
... | StarcoderdataPython |
85235 | import os
import torch
import argparse
import numpy as np
import torch.nn as nn
import torch.optim as optim
from torchviz import make_dot
import torch.nn.functional as F
from timeit import default_timer as timer
from utils import load_data, DEVICE, human_time
class Net(nn.Module):
def __init__(self, gpu=False):
... | StarcoderdataPython |
3307472 | <filename>nwbwidgets/image.py
from pathlib import Path, PureWindowsPath
import matplotlib.pyplot as plt
import plotly.graph_objects as go
import pynwb
from ipywidgets import widgets, fixed, Layout
from pynwb.image import GrayscaleImage, ImageSeries, RGBImage
from tifffile import imread, TiffFile
from .base import fig... | StarcoderdataPython |
3372146 | <filename>setup.py
# -*- coding: utf-8 -*-
import os
from io import open
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
version = {}
with open(
os.path.join(here, "gelfformatter", "version.py"), "r", encoding="utf-8"
) as f:
exec(f.read(), version)
with open("README.md", "r"... | StarcoderdataPython |
3242585 | # calculate BMI
def main():
# input height, weight
height, weight = float(input("input height: ")), float(input("input weight: "))
# calculate BMI
BMI = weight / (height * height)
# print BMI
print(BMI)
if BMI < 18.5:
print("underweight")
elif BMI < 25:
print("normal")
... | StarcoderdataPython |
3365302 | <reponame>HeRuivio/-Algorithm<filename>LeetCode/2019-01-16-165-Compare-Version-Numbers.py
# -*- coding: utf-8 -*-
# @Author: 何睿
# @Create Date: 2019-01-16 14:36:33
# @Last Modified by: 何睿
# @Last Modified time: 2019-01-16 14:57:42
class Solution:
def compareVersion(self, version1, version2):
... | StarcoderdataPython |
132585 | <filename>pyqg/diagnostic_tools.py<gh_stars>10-100
"""Utility functions for pyqg model data."""
import numpy as np
from numpy import pi
def spec_var(model, ph):
"""Compute variance of ``p`` from Fourier coefficients ``ph``.
Parameters
----------
model : pyqg.Model instance
The model object fr... | StarcoderdataPython |
127718 | from .django.base_django_test import BaseDjangoTest as DjangoBaseDjangoTest
from ._base_http_test import BaseHttpTest
class DjangoHttpTest(DjangoBaseDjangoTest, BaseHttpTest):
endpoint_url = '/graphql-methods'
| StarcoderdataPython |
1682242 | <gh_stars>1-10
import pandas as pd
import numpy as np
np.random.seed(42)
import random
random.seed(42)
import os
import time
import glob
import py_entitymatching as em
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import RandomForestClassifier
fr... | StarcoderdataPython |
3210151 | <reponame>gergulo/footprint_server
from datetime import datetime, timedelta
from django.core.exceptions import ObjectDoesNotExist
from django.core.paginator import EmptyPage
from django.http import JsonResponse
from rest_framework.generics import GenericAPIView
from rest_framework.permissions import AllowAny
from commo... | StarcoderdataPython |
7194 | import os
from bids_validator import BIDSValidator
def validate(bids_directory):
print('- Validate: init started.')
file_paths = []
result = []
validator = BIDSValidator()
for path, dirs, files in os.walk(bids_directory):
for filename in files:
if filename == '.bidsignore':
... | StarcoderdataPython |
1610691 | <gh_stars>0
from magma import *
from magma.compatibility import IntegerTypes
from magma.bitutils import int2seq, seq2int
from mantle import FF
from collections import Sequence
__all__ = ['FFs']
__all__ += ['Register', 'DefineRegister', 'register']
__all__ += ['_RegisterName']
#
# Create a column of n FFs initializ... | StarcoderdataPython |
3254657 | <reponame>LordFarquhar/pygamehelper
startText = """
Thank You for using
_____ _____ _ _ _
| __ \ / ____| | | | | | |
| |__) | _| | __ __ _ _ __ ___ ___ | |__| | ___| |_ __ ___ _ __
| ___/ | | | | |_ |/ _` | '_ ` _ \ / _ \ | __ |/ _ \ | '_... | StarcoderdataPython |
3247323 | <gh_stars>10-100
#!/usr/bin/env python
from __future__ import print_function
import glob
import logging
import os
import sys
from pydpkg import Dpkg
logging.basicConfig()
log = logging.getLogger('dpkg_extract')
log.setLevel(logging.INFO)
PRETTY = """Filename: {0}
Size: {1}
MD5: {2}
SHA1: {3}
SHA256: ... | StarcoderdataPython |
118285 | <filename>src/reactive/infoblox_handlers.py<gh_stars>0
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | StarcoderdataPython |
3325938 | """This file is used to save all possible project wide constants.
Includes source folder, the project path, etc.
Example:
Import statement at top of script::
from src.constants import PROJECT_PATH, FIGURE_PATH, GWS_DIR
"""
# import os/pathlib to manipulate file names.
import os
import pathlib
from omeg... | StarcoderdataPython |
96919 | #
# Copyright 2014 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | StarcoderdataPython |
3301572 | <reponame>kosmacheva/shaper
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Shaper (CMDB tool)
Parse properties&configs to datastructure
and create properties&configs from datastructure.
Support <EMAIL>
Minsk 2018
This program is free software; you can redistribute it and/or modify
it unde... | StarcoderdataPython |
3277899 | <filename>spec/petroleum_spec.py<gh_stars>0
from expects import expect, equal, raise_error
from mamba import before, context, description, it
from petroleum import Task, Workflow, WorkflowStatus
with description('task'):
with it('can instantiate without arguments'):
expect(lambda: Task()).not_to(raise_err... | StarcoderdataPython |
8403 | ###############################################################################
# #
'''Website Database-connection-related features''' #
# #
... | StarcoderdataPython |
87236 | from PIL import Image
import os
from os import listdir
from os.path import isfile, join
not_scaled_photo = [f for f in listdir(".") if isfile(join(".", f))]
for photo in not_scaled_photo:
image = Image.open(photo)
if "_not_scaled" in photo:
print(photo.split("_")[0])
os.rename(photo, "{}.png".... | StarcoderdataPython |
1635185 | <reponame>thorstenkranz/eegpy<filename>eegpy/filter/meanfilt.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Mean filtering as used for simultaneous EEG/fMRI"""
import eegpy
from eegpy.misc import FATALERROR
from eegpy.misc import debug
from eegpy.helper import upsample,downsample,find_max_overlap
#from eegpy.filt... | StarcoderdataPython |
44011 | <gh_stars>0
from calendar import month_abbr
from os import getcwd
from re import findall, search, split
import numpy
def pagehero(doc, introduction, topic, author, website, enable_subscriptions=False):
with doc.tag("div", klass="heading-container"):
with doc.tag("h1", klass="content-heading", id="pagetitl... | StarcoderdataPython |
183848 | #!/usr/bin/env python
#
# user management
#
# Copyright <NAME> 2010 <<EMAIL>>
#
# 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 3 of the License, or
# (at your option) any later v... | StarcoderdataPython |
3233623 | <reponame>Zeverin/Coded-Shuffling<filename>overhead.py
############################################################################
# Copyright 2017 <NAME> #
# #
# Licensed under the Apache License, Version... | StarcoderdataPython |
61006 | <reponame>nokia/AttestationEngine<filename>u10/blueprints/sessions.py
# Copyright 2021 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
import secrets
import json
from flask import Blueprint, render_template, flash, redirect, request
import a10.structures.constants
import a10.s... | StarcoderdataPython |
3247709 | <reponame>jzmq/minos
class DummyRPCServer:
def __init__(self):
self.supervisor = DummySupervisorRPCNamespace()
self.system = DummySystemRPCNamespace()
class DummyResponse:
status = 200
reason = 'OK'
body = 'OK'
def read(self):
return self.body
class DummySystemRPCN... | StarcoderdataPython |
86269 | """
Author: <NAME>
Created On: 23 August 2017
"""
# To test if two rectangle intersect, we only have to find out
# if their projections intersect on all of the coordinate axes
import inspect
class Coord:
"""Coord
Class to initialize Coordinate of one point
"""
def __init__(self, x, y):
self... | StarcoderdataPython |
1756814 | from argparse import ArgumentParser, Namespace, ArgumentDefaultsHelpFormatter
from pathlib import Path
from typing import List
import beholder.const as const
_CFG_HELP = "Path to the config file containing website addresses."
_T_HELP = "Number of seconds between subsequent checks."
_O_HELP = "File where the session s... | StarcoderdataPython |
136785 | <reponame>kikeelectronico/data-panel<filename>data-panel-api/homeware.py
import os
import requests
import json
class Homeware:
__api_key = ""
__domain = ""
def __init__(self):
self.__api_key = os.environ.get("HOMEWARE_API_KEY")
self.__domain = os.environ.get("HOMEWARE_DOMAIN")
def getStatus(self):
... | StarcoderdataPython |
4842459 | # This script runs expanded econometric models using both old and new data
# Import required modules
import numpy as np
import pandas as pd
import statsmodels.api as stats
from ToTeX import restab
# Reading in the data
data = pd.read_csv('C:/Users/User/Documents/Data/demoforestation_panel.csv')
# Data... | StarcoderdataPython |
3290127 | <reponame>sonamdkindy/emote-server
from flask import Flask, request, jsonify
from sklearn.externals import joblib
from pathlib import Path
app = Flask(__name__)
clf = None
tf = None
@app.before_first_request
def load():
global clf
global tf
modelFile = Path.cwd() / 'nlp/tweets_model.pkl'
vectFile = P... | StarcoderdataPython |
3375904 | <reponame>timgates42/processing.py
"""
Recursion.
A demonstration of recursion, which means functions call themselves.
Notice how the drawCircle() function calls itself at the end of its block.
It continues to do this until the variable "level" is equal to 1.
"""
def setup():
size(640, 360)
noStroke()
... | StarcoderdataPython |
3339640 | <filename>setup.py
import setuptools
import os
ROOT = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(ROOT, 'README.md'), encoding="utf-8") as f:
README = f.read()
setuptools.setup(
name="ABBA",
version="0.0.1",
author="<NAME> <<EMAIL>>, <NAME> <<EMAIL>>",
description="A symboli... | StarcoderdataPython |
3252388 | """
Continuous integration tools.
"""
import abc
import urllib.request
from .tool import Tool
class ContinuousIntegration(Tool):
"""Abstract class for continuous integration tools."""
__metaclass__ = abc.ABCMeta
def __init__(self, project_name, base_url):
self.project_name = project_name
... | StarcoderdataPython |
2707 | # 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.
import uuid
import random
import math
import time
import typing as t
from . import experiment as hip
# Demos from the README. If one of those ... | StarcoderdataPython |
3265398 | <filename>238. Product of Array Except Self/solution.py
class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
fromLeft = []
ans = [1] * len(nums)
leftProduct = 1
for i in range(1, len(nums)):
leftProduct *= nums[i - 1]
ans[i] = leftProduct... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.