id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3387396 | <gh_stars>10-100
# Copyright (C) 2008 <NAME>, Science and Technology Facilities Council,
# Daresbury Laboratory.
# All rights reserved.
#
# Developed by: <NAME>
# Science and Technology Facilities Council
# Daresbury Laboratory
# Computational Scienc... | StarcoderdataPython |
1778995 | <filename>adjacentes.py
# Função que mostra os dígitos adjacentes iguais de um número
def adjacentes(n):
anterior = -1
atual = -2
adjacentes_iguais = False # Indicador de passagem
while n > 0 and not adjacentes_iguais:
atual = n % 10 # Pega o último dígito do número
anterior = (n // 1... | StarcoderdataPython |
16160 | #coding:utf-8
#gaussian plot (position category)
#<NAME> 2016/06/16
import itertools
import numpy as np
from scipy import linalg
import matplotlib.pyplot as plt
import matplotlib as mpl
from sklearn import mixture
from __init__ import *
from numpy.random import multinomial,uniform,dirichlet
from scipy.stats ... | StarcoderdataPython |
100464 | import copy
if __name__ == '__main__':
epss = np.logspace(-10, -1, 30)
baseline_objective = augmented_objective(x0)
xis = []
for eps in epss:
xi = copy.copy(x0)
xi[4] += eps
xis.append(xi)
objs = [augmented_objective(xi) for xi in xis]
# pool = mp.Pool(mp.cpu_count())
... | StarcoderdataPython |
159749 | tutor = False
def pancakesort(array):
if len(array) <= 1:
return array
if tutor:
print()
for size in range(len(array), 1, -1):
maxindex = max(range(size), key=lamdba i: array[i])
if maxindex+1 != size:
if maxindex != 0:
if tutor:
... | StarcoderdataPython |
1797937 | <gh_stars>0
from sssom import parse, collapse, export_ptable
import unittest
import os
import logging
cwd = os.path.abspath(os.path.dirname(__file__))
data_dir = os.path.join(cwd, 'data')
class TestCollapse(unittest.TestCase):
def setUp(self) -> None:
self.df = parse(f'{data_dir}/basic.tsv')
def te... | StarcoderdataPython |
3249330 | #!/usr/bin/env python3
import datetime
import time
import unicornhathd
# 使用する色の定義
COLOR = (128, 0, 0)
# 0から9とコロンのマッピング
# 横3 x 縦6 = 18ピクセルのフォントを定義
NUMBERS = (
0b111101101101101111, # 0
0b110010010010010111, # 1
0b111001001111100111, # 2
0b111001111001001111, # 3
0b100100100101111001, # 4
0b111... | StarcoderdataPython |
3244572 | <gh_stars>0
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_text as text # Registers the ops.
from benchmarking_tools.model.prediction_model import PredictionModel
# Peculiar models that need more time to code:
# https://tfhub.dev/google/LaBSE/1
# Other models that do not fit our needs
# ques... | StarcoderdataPython |
3317902 | ########
# Copyright (c) 2014-2018 Cloudify Platform Ltd. 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 ... | StarcoderdataPython |
2203 | <reponame>fruttasecca/hay_checker<filename>examples/dhc/rule_example.py<gh_stars>1-10
#!/usr/bin/python3
from pyspark.sql import SparkSession
from haychecker.dhc.metrics import rule
spark = SparkSession.builder.appName("rule_example").getOrCreate()
df = spark.read.format("csv").option("header", "true").load("example... | StarcoderdataPython |
3378136 | """
functions for bin/desi_compute_nightly_bias script
"""
import argparse
from desispec.ccdcalib import compute_nightly_bias
from desispec.io.util import decode_camword, parse_cameras
def parse(options=None):
p = argparse.ArgumentParser(
description="Compute nightly bias from ZEROs")
p.add_argume... | StarcoderdataPython |
42565 | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///gosts.db')
Session = sessionmaker(bind=engine)
s... | StarcoderdataPython |
124848 | class Solution:
def mySqrt(self, x: int) -> int:
left, right = 0, x
while left <= right:
mid = left + (right - left) // 2
square = mid ** 2
if square <= x:
left = mid + 1
elif squ... | StarcoderdataPython |
1740432 | <filename>settings.py
#define some colors (R, G, B)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
DARKGREY = (40, 40, 40)
LIGHTGREY = (100, 100, 100)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
#game settings
WIDTH = 1024 # 16 * 64 or 32 * 32 or 64 * 16
HEIGHT = 768 # 16 * 48 or 32 * 24 or 64 * 12
FPS ... | StarcoderdataPython |
17063 | # pylint: disable=C0121
"""http://www.logilab.org/ticket/124337"""
import gtk
def print_some_constant(arg=gtk.BUTTONS_OK):
"""crash because gtk.BUTTONS_OK, a gtk enum type, is returned by
astroid as a constant
"""
print(arg)
| StarcoderdataPython |
3202103 | <reponame>scikit-hep/statutils
# -*- coding: utf-8 -*-
from typing import Union
from ..calculators.basecalculator import BaseCalculator
from ..parameters import POI, POIarray
"""
Module defining the base class for hypothesis tests.
"""
class BaseTest(object):
def __init__(
self,
calculator: Base... | StarcoderdataPython |
1733411 | #
# Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | StarcoderdataPython |
1769916 | # Generated by Django 2.0.3 on 2018-04-09 20:42
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('entrance', '0070_auto_20180409_2028'),
]
operations = [
migrations.AddFiel... | StarcoderdataPython |
3214836 | '''
Created on 2020-09-22 16:07:04
Last modified on 2020-09-23 07:10:39
@author: <NAME> (<EMAIL>))
'''
# imports
from abaqus import session
# variable initialization and odb opening
job_name = 'Simul_SUPERCOMPRESSIBLE_RIKS'
odb_name = '{}.odb'.format(job_name)
odb = session.openOdb(name=odb_name)
riks_results = {... | StarcoderdataPython |
82822 | <gh_stars>0
"""Items models description."""
from colorfield.fields import ColorField
from django.core.validators import MinValueValidator
from django.db import models
class ItemStatuses:
"""Constant item statuses."""
NEVER = "Never"
ONCE = "Once"
SELDOM = "Seldom"
OFTEN = "Often"
DAILY = "Da... | StarcoderdataPython |
92245 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 24 16:57:31 2017
@author: Jean-Michel
"""
import AstarClass as AC
import sys
sys.path.append("../model")
from WeatherClass import Weather
import numpy as np
import SimulatorTLKT as SimC
from SimulatorTLKT import Simulator
import matplotlib.pyplot as plt
im... | StarcoderdataPython |
26846 | from stronghold.views import StrongholdPublicMixin
import django
from django.views.generic import View
from django.views.generic.base import TemplateResponseMixin
if django.VERSION[:2] < (1, 9):
from django.utils import unittest
else:
import unittest
class StrongholdMixinsTests(unittest.TestCase):
def ... | StarcoderdataPython |
65946 | #!/usr/bin/env python
# coding: utf-8
# In[5]:
1 + 1 * 2
# In[4]:
20 // 3 + 20 // 7 ** 2
# In[2]:
import random
4 + random.randint(10, 100)
# In[5]:
import random
4 + random.randint(10, 100)
# In[ ]:
| StarcoderdataPython |
1662947 | '''
File name: test_predictPlantStatistics
Date created: 27/11/2018
Feature: #Enter feature description here
'''
from unittest import TestCase
import pytest
from elecsim.plants.plant_costs.estimate_costs.estimate_modern_power_plant_costs.predict_modern_plant_costs import \
PredictModernPlantParameters
__author__... | StarcoderdataPython |
3255558 | from sklearn.metrics import silhouette_samples, silhouette_score
from random import randint
import sys
sys.path.insert(0, 'src/genetic_algorithm/')
from individual import Individual
from sklearn.metrics.pairwise import cosine_similarity, euclidean_distances, polynomial_kernel, sigmoid_kernel, cosine_distances
import nu... | StarcoderdataPython |
3322302 | from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
QApplication, QWidget,
QHBoxLayout, QVBoxLayout,
QGroupBox, QRadioButton,
QPushButton, QLabel, QButtonGroup, QListWidget,
QTextEdit, QInputDialog, QMessageBox)
import json
notes = {}
'''
with open('info.j... | StarcoderdataPython |
3271185 | <reponame>opengovsg/ttt-scanner
from subprocess import check_output
from datetime import datetime
import json
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
from time import sleep
from time import strftime
from os import listdir, path, makedirs
today = strftime("%Y-%m-%d")
... | StarcoderdataPython |
193402 | <reponame>HiAwesome/dive-into-python3-practice<gh_stars>0
import c02.p044_humansize as humansize
print(humansize.__name__)
"""
c02.p044_humansize
"""
| StarcoderdataPython |
48404 | import logging
import pickle
from datetime import datetime
import munch
from rocketgram import Bot, Dispatcher, DefaultValuesMiddleware, ParseModeType
logger = logging.getLogger('mybot')
router = Dispatcher()
def get_bot(token: str):
bot = Bot(token, router=router, globals_class=munch.Munch, context_data_clas... | StarcoderdataPython |
3367022 | <filename>spektral/layers/ops/modes.py<gh_stars>1-10
from tensorflow.keras import backend as K
SINGLE = 1 # Single (rank(a)=2, rank(b)=2)
MIXED = 2 # Mixed (rank(a)=2, rank(b)=3)
iMIXED = 3 # Inverted mixed (rank(a)=3, rank(b)=2)
BATCH = 4 # Batch (rank(a)=3, rank(b)=3)
UNKNOWN ... | StarcoderdataPython |
1630550 | from distutils.core import setup
try:
from setuptools import find_packages
except ImportError:
print ("Please install Distutils and setuptools"
" before installing this package")
raise
setup(
name='relay.runner',
version='0.1.10.dev0',
description=(
'A smart thermostat. Give... | StarcoderdataPython |
4805089 | <filename>CODES/S7 - Functions-Methods - Working With Reusable Code/3-methodsdemo3.py
"""
Positional Parameters
They are like optional parameters
And can be assigned a default value, if no value is provided from outside
"""
def sum_nums(n1, n2=4):
"""
Get sum of two numbers
:param n1:
:param n2:
:r... | StarcoderdataPython |
1602397 | import os
from base64 import b64encode, b64decode
from typing import AnyStr, List, Dict
from collections import Counter
import numpy as np
import cv2 as cv
import keras
import tensorflow as tf
from yolo4.model import yolo4_body
from decode_np import Decode
__all__ = ("DetectJapan", "detect_japan_obj")
session = tf.... | StarcoderdataPython |
1609859 | import cv2
import pandas as pd
from tqdm import tqdm
train = pd.read_csv('Christof/assets/train_ext1.csv')
#test = pd.read_csv('Christof/assets/sample_submission.csv')
path_to_train = 'Christof/assets/ext_tomomi/'
#path_to_test = 'Christof/assets/test_rgby_512/'
fns = [path_to_train + f[:-4] + '.png' for f in train[... | StarcoderdataPython |
3679 | <reponame>AaronFriel/pulumi-google-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Unio... | StarcoderdataPython |
2011 | # -*- coding: utf-8 -*-
from ddtrace.compat import PY2
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY
from ddtrace.contrib.flask.patch import flask_version
from ddtrace.ext import http
from ddtrace.propagation.http import HTTP_HEADER_TRACE_ID, HTTP_HEADER_PARENT_ID
from flask import abort
from . import BaseFl... | StarcoderdataPython |
3358134 | <gh_stars>0
class CommandScaffold:
""" scaffold class """
def __init__(self, args):
"""initialize the class
:params args: type object
"""
from netnir.constants import NR
from netnir.core.connection import register_connections
import logging
self.args = ... | StarcoderdataPython |
1637560 | import torch
import Corr2D_ext
def int_2_tensor(intList):
return torch.tensor(intList, dtype=torch.int, requires_grad=False)
def tensor_2_int(t):
assert len(t.size()) == 1
assert t.size()[0] == 5
assert t.dtype == torch.int
return t.tolist()
class Corr2DF(torch.autograd.Function):
@staticme... | StarcoderdataPython |
3359589 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 9 12:52:44 2019
@author: Excalibur
"""
import numpy as np
import numpy.linalg as LA
from numpy import random
import matplotlib.pyplot as plt
from parameterDefaults import defaults
from jacobianSalt import computeJac
from parameterRanges import ranges
from tqdm import tq... | StarcoderdataPython |
3380107 | # SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
from typing import Dict, Tuple, Any
from pandas import... | StarcoderdataPython |
16965 | import torch
import pytest
# NOTE: also registers the KL divergence
from chmp.torch_utils import NormalModule, WeightsHS, fixed
def test_kl_divergence__gamma__log_normal():
p = torch.distributions.LogNormal(torch.zeros(2), torch.ones(2))
q = torch.distributions.Gamma(torch.ones(2), torch.ones(2))
torch.... | StarcoderdataPython |
1672558 | # Copyright 2020 The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | StarcoderdataPython |
3206812 | import numpy as np
from houghvst.estimation import gat
def compare_variance_stabilization(img, img_noisy, sigma_gt, alpha_gt,
sigma_est, alpha_est):
assess_variance_stabilization(img, img_noisy, sigma_gt, alpha_gt,
heading='Ground truth')
as... | StarcoderdataPython |
3294403 | <reponame>amalinovskiy/Appraise
# Generated by Django 2.2 on 2019-05-17 16:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('EvalData', '0033_auto_20190228_0826'),
]
operations = [
migrations.CreateMode... | StarcoderdataPython |
113616 | <reponame>plaf2000/webspec
from django.urls import path
from . import views
#This is urls.py
urlpatterns = [
path('get/', views.get, name='get'),
path('save/', views.save, name='save'),
path('create/', views.create, name='create'),
path('delete/', views.delete, name='delete'),
] | StarcoderdataPython |
1668240 | <filename>tmy.py<gh_stars>0
"""Module to do processing of TMY3 files into Pandas dataframes and CSV files.
"""
from datetime import datetime
import csv
from pathlib import Path
import pandas as pd
import util as au # a utility library in this repo.
def process_tmy(raw_tmy_dir, output_dir):
"""Takes raw TMY file... | StarcoderdataPython |
3282211 | <filename>finalArtisticTransfer.py
# <NAME> and <NAME>
# W4731 Computer Vision Final Project - Artistic Style Transfer
# Keras implementation of Artistic Style Transfer as described by Gatys et al 2015/6
# NOTE: keras.image_data_format assumed to be channels last
import sys
import time
import numpy as np
from keras.a... | StarcoderdataPython |
3383082 | <reponame>NathaliaBarreiros/nlp_api
from app.models.zeroshot_inference import ZeroShotInferenceBase
from app.models.user import UserBase
from pydantic import BaseModel
from typing import Optional
class ZeroShotInferenceCreate(ZeroShotInferenceBase):
result: dict[str, float]
class ZeroShotInferenceRead(ZeroShotI... | StarcoderdataPython |
1758260 | from autumn.projects.covid_19.mixing_optimisation.constants import PHASE_2_START_TIME
from autumn.models.covid_19.mixing_matrix import (
build_dynamic_mixing_matrix,
)
from autumn.tools.inputs.demography.queries import get_iso3_from_country_name
from .mixing_opti import build_params_for_phases_2_and_3
# FIXME th... | StarcoderdataPython |
156455 | <reponame>anirudhakulkarni/codes
for _ in range(int(input())):
a,b,q=map(int,input().split())
arr=[]
for i in range(q):
arr+=[list(map(int,input().split()))]
res=0
if a!=b:
for j in range(arr[i][0],arr[i][1]+1):
if (j%a)%b!=(j%b)%a:
... | StarcoderdataPython |
4833854 | <reponame>JohanComparat/pyEmerge
import h5py # HDF5 support
import os
import glob
import numpy as n
from scipy.interpolate import interp1d
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as p
plotDir = os.path.join(os.environ['HOME'], 'wwwDir', "eRoMok", "logNlogS")
from astropy.cosmology impor... | StarcoderdataPython |
3370416 | <reponame>zkouba/advent-of-code
import unittest
from aoc2020.task11.task11 import load, _interlink_neighboring_seats, Seat
class LobbyTest(unittest.TestCase):
def test_full_flow(self):
threshold = 5
lobby = load("./test_input.txt", -1)
self.assertEqual(10, len(lobby.plan))
self.as... | StarcoderdataPython |
1656150 | """ BiotSavart_CUDA module. """
# ISC License
#
# Copyright (c) 2020–2021, <NAME>, <NAME>. <<EMAIL>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all cop... | StarcoderdataPython |
3337684 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Code for training model for contradictory_claims."""
| StarcoderdataPython |
169535 | <filename>examples/account.py
from kauripay.processing import KauriPay
api_key = ''
api_secret = ''
host = ''
pay = KauriPay(api_key=api_key,
api_secret=api_secret,
host=host)
def get_total_balance(view_currency='BTC') -> float:
"""
Shows total balance for account in chosen cur... | StarcoderdataPython |
76809 | <filename>analysis_scripts/check_direction.py<gh_stars>1-10
#! /usr/bin/env python
"""
Calculating the fraction of upgoing events
CAUTION: Assuming chan0 is the uppermost and
chan1 is below chan0
"""
import numpy as n
import pylab as p
import sys
f = open(sys.argv[1])
directions = []
for line in f.readlin... | StarcoderdataPython |
3331709 | <reponame>jperras/Flask-ApiExceptions<gh_stars>1-10
"""
Flask-APIExceptions
~~~~~~~~~~~~~~~~~~~
Providing HTTP error responses in the form of Python exceptions that can
be serialized as response objects.
"""
import os
from setuptools import setup
with open('README.rst') as file:
LONG_DESCRIPTION = file.read()
... | StarcoderdataPython |
1698006 | from .icp import *
# TODO: move contents from nonconformist.icp here
# -----------------------------------------------------------------------------
# TcpClassifier
# -----------------------------------------------------------------------------
class TcpClassifier(BaseEstimator, ClassifierMixin):
"""Transductive ... | StarcoderdataPython |
1661049 | <reponame>Zoomdata/err-stackstorm
import setuptools
#with open("README.md", "r") as fh:
# long_description = fh.read()
setuptools.setup(
name="err-stackstorm",
version="2.1.4",
author="Err-StackStorm Plugin contributors",
author_email="<EMAIL>",
description="An Errbot plugin for StackStorm Chat... | StarcoderdataPython |
64951 | <reponame>lycantropos/ground
"""Basis of computational geometry."""
__version__ = '7.1.1'
| StarcoderdataPython |
3372252 | """
Collection of utils for testing tree converters.
"""
gbdt_implementation_map = {
"tree_trav": "<class 'hummingbird.ml.operator_converters._tree_implementations.TreeTraversalGBDTImpl'>",
"perf_tree_trav": "<class 'hummingbird.ml.operator_converters._tree_implementations.PerfectTreeTraversalGBDTImpl'>",
"... | StarcoderdataPython |
3344346 | import numpy as np
from scipy.integrate import odeint
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['font.sans-serif'] = "Arial"
matplotlib.rcParams['font.family'] = "sans-serif"
# Solve the ODE of 2-node negative feedback loop model
def ode(y, t):
dydt = np.zeros(y.shape)
ka1 = 0.8
... | StarcoderdataPython |
4816070 | from modules import skeleton
from lib.core import utils
from lib.mode import speed
from lib.sender import execute
from lib.sender import polling
from lib.sender import report
from lib.sender import summary
class LinkFinding(skeleton.Skeleton):
"""docstring for LinkFinding"""
def banner(self):
utils.p... | StarcoderdataPython |
3338537 | <gh_stars>0
import enum
from datetime import datetime
from app import db, login
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from sqlalchemy import Enum
@login.user_loader
def load_user(id):
return User.query.get(int(id))
group_x_course = db.Table('g... | StarcoderdataPython |
3273852 | import os
import pudb
import shutil
from tqdm import tqdm
from sklearn.model_selection import train_test_split
from scipy.io import loadmat, savemat
def patientwise_splitting(train, test, img_list):
patient_ids = [f.split('_')[1] for f in img_list]
patient_ids = list(set(patient_ids))
train_ids, test_ids ... | StarcoderdataPython |
1749369 | //this will start the dashboard, all interfaces, etc
| StarcoderdataPython |
4824059 | import sys
import os
import numpy as np
import pickle
from nltk.corpus import wordnet as wn
inpfile=sys.argv[1]
opdir=sys.argv[2]
opname=sys.argv[3]
d = np.load(inpfile)
embeddings = d['embeddings']
synsets = d['synsets']
print ('input', embeddings.shape)
emb_dim = embeddings.shape[1]
zeros = np.zeros(emb_dim)
synse... | StarcoderdataPython |
3304759 | <reponame>naegawa/pict_generator
#!/usr/bin/env python
"""Variational auto-encoder for MNIST data.
References
----------
http://edwardlib.org/tutorials/decoder
http://edwardlib.org/tutorials/inference-networks
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_functi... | StarcoderdataPython |
125888 | # Sciprt to calculate user location centroids with parallel processing
import multiprocessing
import psycopg2 # For connecting to PostgreSQL database
import pandas as pd # Data analysis toolkit with flexible data structures
import numpy as np # Fundamental toolkit for scientific computation with N-dimensional array s... | StarcoderdataPython |
3279036 | # Generated by Django 2.1 on 2018-08-26 10:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0021_auto_20180826_1541'),
]
operations = [
migrations.CreateModel(
name='Community',
fields=[
... | StarcoderdataPython |
1688196 | <reponame>NIVANorge/s-enda-playground
from dataclasses import dataclass
from bindings.csw.cartesian_csref_type import CartesianCsrefType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class CartesianCsref(CartesianCsrefType):
class Meta:
name = "cartesianCSRef"
namespace = "http://www.op... | StarcoderdataPython |
1673956 | from .clipboard import start_import
action_name = 'Clipboard' | StarcoderdataPython |
2903 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""recumpiler
Recompile text to be semi-readable memey garbage.
"""
__version__ = (0, 0, 0)
| StarcoderdataPython |
1776734 | <reponame>d--j/salt
'''
Module for configuring DNS Client on Windows systems
'''
def __virtual__():
'''
Load if the module win_dns_client is loaded
'''
return 'win_dns_client' if 'win_dns_client.add_dns' in __salt__ else False
def dns_exists(name, servers=None, interface='Local Area Connection'):
... | StarcoderdataPython |
3373384 | import pandas as pd
REGEX_SEARCHES = {
'class_matches': '^([OABFGKM])',
'type_matches': '^.*([VI])+',
'number_matches': '^[OABFGKM]([0-9])'
}
USED_SEARCHES = ['class', 'type']
def run():
raw_df = load_csv_data('rawStars.csv')
raw_df = determine_matches(raw_df)
df = apply_regex(raw_df)
... | StarcoderdataPython |
1749099 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class Lab(pu... | StarcoderdataPython |
1738867 | # -*- coding: utf-8 -*-
"""
@author: <NAME>, Ph.D. (2020)
Single-Molecule TIRF Viewer App
"""
from PyQt5.QtWidgets import QApplication, QSizePolicy
from PyQt5 import QtWidgets, QtCore, QtGui
import sys
from collections import OrderedDict
from smtirf import gui
# =======================================================... | StarcoderdataPython |
3251007 | <filename>build/lib/sbmltopyode/python3ClassGenerator.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 3 15:50:45 2018
@author: Steve
"""
import re
import numpy as np
import sys
from sbmltopyode.ModelDataClasses import *
def GenerateModel(modelData, outputFilePath, objectName = 'SBMLmodel'):
"""
... | StarcoderdataPython |
3290357 | <reponame>johanesmikhael/pyinn
from .ncrelu import ncrelu
from .dgmm import dgmm
from .cdgmm import cdgmm
from .im2col import im2col, col2im
from .conv2d_depthwise import conv2d_depthwise
from .modules import Conv2dDepthwise
| StarcoderdataPython |
3277480 | <filename>utils/utils_statistics.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Utils to perform to compute MAR coefficients and perform statistical tests
Written by H.Turbé, March 2022.
"""
import copy
import multiprocessing as mp
import os
import random
import re
import numpy as np
import pandas... | StarcoderdataPython |
1738433 | <gh_stars>1-10
#!/usr/bin/env python
#
# Copyright (c) 2017, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
#
# All rights reserved.
#
# The Astrobee platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this ... | StarcoderdataPython |
1631157 | # Copyright 2017 F5 Networks 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 writi... | StarcoderdataPython |
43796 | <filename>tests/test_automechanic/test_mol_graph.py
""" test the automechanc.mol.graph module
"""
import numpy
from automechanic.mol import graph
C8H13O_CGR = (
{0: ('C', 3, None), 1: ('C', 3, None), 2: ('C', 1, None),
3: ('C', 1, None), 4: ('C', 1, None), 5: ('C', 1, None),
6: ('C', 2, None), 7: ('C', ... | StarcoderdataPython |
3228490 | <gh_stars>0
from importlib import import_module
import KratosMultiphysics as Kratos
import KratosMultiphysics.FluidDynamicsApplication as KratosCFD
import KratosMultiphysics.RANSApplication as KratosRANS
from KratosMultiphysics import IsDistributedRun
from KratosMultiphysics import VariableUtils
from KratosMultiphysi... | StarcoderdataPython |
56412 | <reponame>Sourav692/FAANG-Interview-Preparation<gh_stars>1000+
# Time: O(n)
# Space: O(1)
import operator
from functools import reduce
class Solution(object):
"""
:type nums: List[int]
:rtype: int
"""
def singleNumber(self, A):
return reduce(operator.xor, A)
| StarcoderdataPython |
3213153 | <filename>v6.0.6/ips/test_fortios_ips_global.py
# Copyright 2019 Fortinet, Inc.
#
# 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... | StarcoderdataPython |
1634495 | #!/usr/bin/env python
#
# A simple example showcasing the basics of systest.
#
import logging
import systest
LOGGER = logging.getLogger(__name__)
# Define a testcase.
class MyTestCase(systest.TestCase):
"""Test case description.
"""
def __init__(self, name):
super(MyTestCase, self).__init__()
... | StarcoderdataPython |
3376203 | <filename>source-code/multiexp/ed25519.py<gh_stars>1-10
import random
# curve parameters
b = 256
q = 2**255 - 19
l = 2**252 + 27742317777372353535851937790883648493
# op counts
counts = {}
def reset():
counts['add'] = 0
counts['multiply'] = 0
# compute b^e mod m
#def exponent(b,e,m):
# if e == 0:
# ... | StarcoderdataPython |
4818780 | import requests,sys,time,json
from bs4 import BeautifulSoup
import argparse
banner = """\033[0;34m=========================================================
🇵 🇭 🇫 🇫 🇹 🇪 🇦 🇲
\033[0;34m=========================================================
\033[1;32mScript edit By \033[1;31m :\033[1;0m คเкђєภ
\033[1;32mPH... | StarcoderdataPython |
1765142 | # A recursive solution
# How would you solve this iteratively?
def checkBalanced(rootNode):
# An empty tree is balanced by default
if rootNode == None:
return True
# recursive helper function to check the min depth of the tree
def minDepth(node):
if node == None:
return ... | StarcoderdataPython |
1789252 | from rpython.rlib.rarithmetic import ovfcheck
from rpython.rlib.rbigint import rbigint, _divrem
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rtyper.lltypesystem.lloperation import llop
from som.vmobjects.abstract_object import AbstractObject
from som.vm.globals import trueObject, falseObject
cla... | StarcoderdataPython |
29897 | from typing import List
from django.shortcuts import render
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from assignment.models import Assignment
from course.models import Course
class CourseListView(ListView):
template_name = 'course/course_list.html'
model... | StarcoderdataPython |
3227038 | <gh_stars>1-10
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import cv2
from util import *
import argparse
import os
import os.path as osp
from darknet import Darknet
import pickle as pkl
import pandas as pd
import random
def ar... | StarcoderdataPython |
3347133 | <gh_stars>0
import keys
@keys.key("test")
def test_func():
print("Before exception")
raise Exception("Test Exception")
print("After exception")
| StarcoderdataPython |
3370235 | """
.. conftest.py:
Most of the tests are currently doctests. Have patience.
"""
import sys
from contextlib import contextmanager
import pytest
import sqlalchemy as sa
from flask import Flask, appcontext_pushed, g
from oso import Oso
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declara... | StarcoderdataPython |
41440 | import numpy as np
import matplotlib.pyplot as plt
from utils import get_state_vowel
class HopfieldNetwork:
"""
Creates a Hopfield Network.
"""
def __init__(self, patterns):
"""
Initializes the network.
Args:
patterns (np.array): Group of states to be memorized by ... | StarcoderdataPython |
1657529 | import matplotlib.pyplot as plt
import sklearn.datasets as skdata
import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import sklearn
numeros = skdata.load_digits()
target = numeros['target']
imagenes = numeros['images']
n_imagenes = len(target)
data = imagenes.reshape((n_imagenes,... | StarcoderdataPython |
2658 | <reponame>zengrx/S.M.A.R.T<filename>src/advanceoperate/malimgthread.py<gh_stars>1-10
#coding=utf-8
from PyQt4 import QtCore
import os, glob, numpy, sys
from PIL import Image
from sklearn.cross_validation import StratifiedKFold
from sklearn.metrics import confusion_matrix
from sklearn.neighbors import KNeighborsClassif... | StarcoderdataPython |
48241 | <filename>retrieverdash/dashboard_script/status_dashboard_tools.py
import json
import os
from difflib import HtmlDiff
from shutil import rmtree, move, copytree
from tempfile import mkdtemp
from retriever import reload_scripts
from retriever.engines import engine_list, postgres
from retriever.lib.defaults import HOME_D... | StarcoderdataPython |
13379 | # Copyright (C) 2010-2011 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distrib... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.