id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
9673383
<reponame>tugot17/Pytorch-Lightning-Templates- import albumentations as A import pytorch_lightning as pl from albumentations.pytorch import ToTensorV2 from torch.utils.data import DataLoader from .dataset import ImageClassificationDataset class ImageClassificationDatamodule(pl.LightningDataModule): def __init__(...
StarcoderdataPython
6491097
<reponame>arsho/Hackerrank_30_Days_of_Code_Solutions ''' Title : Day 2: Operators Domain : Tutorials Author : <NAME> Created : 03 April 2019 ''' #!/bin/python3 import math import os import random import re import sys # Complete the solve function below. def solve(meal_cost, tip_percent, tax_percen...
StarcoderdataPython
6659803
<filename>number_theory/primality_test/naive.py<gh_stars>0 from math import sqrt from parameterized import parameterized import unittest class Test(unittest.TestCase): @parameterized.expand([ (11, True), (15, False), (1, False), (5, True), (4, False), (49, False) ...
StarcoderdataPython
3550063
import sys, json; with open(sys.argv[1]) as f: data = json.load(f) for x in range(2,len(sys.argv)): data = data[sys.argv[x]] print data
StarcoderdataPython
109964
from django.apps import apps from django.core.management.base import BaseCommand from rayures.events import dispatch class Command(BaseCommand): help = 'Sync stripe events' def handle(self, *args, **options): # TODO: option to select only the one that have only failed or never processed cls =...
StarcoderdataPython
82531
<reponame>monk-after-90s/diyblog from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.http import HttpResponseRedirect from django.shortcuts import render, get_object_or_404 # Create your views here. from django.urls import reverse from django....
StarcoderdataPython
6571999
<filename>python/fitfitparse.py #!/usr/bin/env python3 import fitparse import sys import time import os start = time.time() fitfile = fitparse.FitFile( sys.argv[1] ) records = [] laps = [] for record in fitfile.get_messages( 'record' ): records.append( record ) for lap in fitfile.get_messages( 'lap' ): lap...
StarcoderdataPython
3279543
from sklearn.model_selection import train_test_split; from sklearn.datasets import make_moons from supervised_learning.trees.random_forests import RandomForestClassifier from misc.plot_functions import plot_decision def main(): #We sample 100 points from the make_moons function in order to classify them. X, y...
StarcoderdataPython
5188548
import logging from typing import Optional import docker # type: ignore[import] from docker.client import DockerClient # type: ignore[import] from docker.models.networks import Network # type: ignore[import] from docker.errors import APIError # type: ignore[import] import psutil # type: ignore[import] from .erro...
StarcoderdataPython
3464044
<reponame>rsgit95/med_kg_txt_multimodal from rdflib import Graph, URIRef from tqdm import tqdm import pickle # kg 로드 1분걸려요 kg = Graph() kg.parse('mimic_sparqlstar_kg.xml', format='xml', publicID='/') def build_dict(triples, nodes, edges): h, r, t = triples #for (h,r,t) in triples: if h not in nodes: ...
StarcoderdataPython
214186
import pydsm import pydsm.similarity from scipy.stats import spearmanr from pkg_resources import resource_stream import pickle import os def synonym_test(matrix, synonym_test, sim_func=pydsm.similarity.cos): """ Evaluate DSM using a synonym test. :param matrix: A DSM matrix. :param synonym_test: A dic...
StarcoderdataPython
6470549
import stats_batch as sb import numpy as np import numpy.testing as npt # Test mean_batch returns the mean if prior_mean and prior_sample_size are missing def test_mean_batch_missing_prior_mean_prior_sample_size(): x = list(range(1, 100)) assert sb.mean_batch(x)[0] == np.mean(x) assert sb.mean_batch(x)[1]...
StarcoderdataPython
11314598
from django.contrib.auth.models import User from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver from rest_framework.authtoken.models import Token @receiver(post_save, sender=User) def create_auth_token(sender, instance=None, created=False, **kwargs): if...
StarcoderdataPython
265318
<filename>model/wordrep.py<gh_stars>1-10 from __future__ import print_function from __future__ import absolute_import import torch import torch.nn as nn import numpy as np class WordRep(nn.Module): def __init__(self, data): super(WordRep, self).__init__() print("build word representation...") ...
StarcoderdataPython
11246563
<reponame>cfnyu/distributed_db # -*- coding: utf-8 -*- """ Site This module represents a site """ from enum import IntEnum from sites.data_manager import DataManager from objects.variable import Variable class SiteStatus(IntEnum): """ Represents the possible status of a Site """ UP = 1, DOWN = 2 class S...
StarcoderdataPython
3283034
<reponame>knownmed/opentrons<gh_stars>0 import logging import numpy as np # type: ignore from dataclasses import dataclass from typing import Optional, List from opentrons import config from opentrons.config.robot_configs import get_legacy_gantry_calibration from opentrons.calibration_storage import modify, types, g...
StarcoderdataPython
8186508
<gh_stars>10-100 from Instrucciones.Excepcion import Excepcion from tkinter.constants import FALSE from Instrucciones.Sql_create.ShowDatabases import ShowDatabases from Instrucciones.TablaSimbolos.Instruccion import * from Instrucciones.Tablas.BaseDeDatos import BaseDeDatos from storageManager.jsonMode import * class C...
StarcoderdataPython
12827807
""" Save certstream data into Elasticsearch so that it can be queried by Kibana later on. """ from datetime import datetime from elasticsearch_dsl import connections, analyzer from elasticsearch_dsl import Document, Date, Text, Keyword from .base import Storage ANALYZER = analyzer('standard_analyzer', ...
StarcoderdataPython
1648346
<gh_stars>1-10 #!/usr/bin/env python # Script that generates triangle specifications for all # possible combinations of corner signs for the marching # cubes algorithm. # # Assumes that the corner signs are encoded as integers # where bit i indicates whether corner i (as given by the # corner index specification belo...
StarcoderdataPython
1911946
<filename>examples/autobahn-twisted-flask/app.py import argparse import json import msgpack from flask import Flask, render_template from twisted.internet import reactor from twisted.web.server import Site from twisted.web.resource import Resource from twisted.web.wsgi import WSGIResource from autobahn.websocket import...
StarcoderdataPython
3374095
import pytest from cell import Cell def _as_digit(digit: int): return digit def test_init_with_invalid_value(): with pytest.raises(Exception): Cell(10) @pytest.mark.parametrize("repr_fun", [_as_digit, Cell]) def test_exclude_and_solve(repr_fun): cell = Cell() cell.exclude([repr_fun(i) f...
StarcoderdataPython
1993952
<gh_stars>0 # coding=utf-8 """ Collect HAProxy Stats #### Dependencies * urlparse * urllib2 """ import re import urllib2 import base64 import csv import diamond.collector class HAProxyCollector(diamond.collector.Collector): def get_default_config_help(self): config_help = super(HAProxyCollector, s...
StarcoderdataPython
4866838
""" The :mod:`part` package is designed to maintain subsets of sorted spaces. It defines several classes. For atomic values: * :class:`TotallyOrdered` which represents totally ordered type; * :class:`TO` which represents a generic totally ordered type; * :class:`Atomic` which represents any convex subset of a totall...
StarcoderdataPython
8194751
# -*- coding: utf-8 -*- """ test_parse_haadf_stem ~~~~~~~~~~~~~ """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest from lxml import etree from chemdataextractor.doc.text import Sentence from chemda...
StarcoderdataPython
1643766
from ubiquiti.unifi import API as Unifi_API import json import paho.mqtt.client as mqtt import time class anybody_home(): def __init__(self): self.n_devices = 4 self.dev_1 = '192.168.0.51' self.dev_2 = '192.168.0.52' self.dev_3 = '192.168.0.53' self.dev_4 = '192.168.0.54' ...
StarcoderdataPython
9625941
import re class EvalNode: """An eval node""" def __init__(self, name): self.name = name; self.cached = -1 def parse(self): if(self.cached == -1): #print("parsing", self.name) self.cached = applyOp(self.l.parse(), self.op, self.r.parse()) return self.cached; class ConstNode: def __init__(self, const)...
StarcoderdataPython
323458
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import textwrap import pytest from pants.backend.kotlin import target_types from pants.backend.kotlin.dependency_inference import kotlin_parser from pa...
StarcoderdataPython
1675890
import codecs import gzip from lxmls.sequences.label_dictionary import * from lxmls.sequences.sequence import * from lxmls.sequences.sequence_list import * from os.path import dirname import numpy as np # This is also needed for theano=True # from nltk.corpus import brown # Directory where the data files are located...
StarcoderdataPython
1690007
from django.contrib import admin from .models import librarian admin.site.register(librarian)
StarcoderdataPython
8059926
<filename>tests/examples/testcases.py #!/usr/bin/env python3 import argparse import unittest import itertools import json import subprocess import os import sys import shutil import gzip import aug_out_filter as afilter import aug_comparator as comp # This script executes AUGUSTUS test cases based on the examples # f...
StarcoderdataPython
8118051
<filename>main.py import os import time import datetime as dt import schedule from threading import Timer from weather import Weather, Unit weather = Weather(unit=Unit.CELSIUS) lookup = weather.lookup(2487365) condition = lookup.condition needToWaterEarly = True needToWaterMore = True triggerConditions = ["tropical ...
StarcoderdataPython
9778132
# TODO(matt): Reformat script. # flake8: noqa """ Big Data Training ================= """ ############################################################################### # train ############################################################################### import argparse import os import sys import time from typing...
StarcoderdataPython
4851379
from typing import Callable class Solution: def rotate(self, matrix: list[list[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ new_matrix = [[0 for _ in row] for row in matrix] n = len(matrix) for i, row in enumerate(matrix): ...
StarcoderdataPython
5034669
from .kanji_svg import KanjiSvg from cached_property import cached_property from requests_html import HTMLSession import backoff BASE_URL = "https://jisho.org/search/{}%20%23kanji" MAX_TRIES = 4 SVG_SELECTOR = ".stroke_order_diagram--outer_container svg" class ContentNotFound(Exception): """ Represents an erro...
StarcoderdataPython
5024104
#-*- coding: utf-8 -*- """ CHOCO CLI(Command Line Interface) Handler """ import sys import os import shlex import inspect import imp import psutil import pickle import traceback import time try: import readline except: print >> sys.stderr, 'GNU Readline is not supported by this environment' from datetime import...
StarcoderdataPython
5146371
'''given a list of integers and a number n, find a pair that sums to the number n''' #Using hash table - O(n) time and O(n) space def get_pair_using_hashmap(lst, num): num_dict = {} for each in lst: if (num -each) in num_dict: return [each,num-each] else: num_dict[e...
StarcoderdataPython
6435201
import logging from functools import wraps from data import model from util.http import abort logger = logging.getLogger(__name__) def _raise_unauthorized(repository, scopes): raise StandardError("Unauthorized acces to %s", repository) def _get_reponame_kwargs(*args, **kwargs): return [kwargs["namespace...
StarcoderdataPython
8016833
<filename>microutil/array_utils.py<gh_stars>1-10 __all__ = [ "zeros_like", "not_xr", "axis2int", ] import dask.array as da import numpy as np import xarray as xr import zarr def zeros_like(arr): """ Smooth over the differences zeros_likes for different array types Parameters ---------...
StarcoderdataPython
9723778
<filename>submodular_optimization/algorithms/algorithm_driver.py<gh_stars>0 """ This class runs an algorithm with given config """ import logging import numpy as np from copy import deepcopy from timeit import default_timer as timer from algorithms.distorted_greedy import DistortedGreedy from algorithms.cost_scaled_gre...
StarcoderdataPython
6683254
''' Stores all unique rooms in game, every type of room got its own description and features, this is intended to be used as the building block for the dungeon generation function which is not yet implemented > Must-have room attributes: NAME, USERDESC, DESC, NORTH, SOUTH, EAST, WEST, UP, DOWN, GROUND, SHOP, ENEMIES ...
StarcoderdataPython
6492812
# Copyright (c) 2012-2015 Netforce Co. Ltd. # # 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, publ...
StarcoderdataPython
5065380
cores = {'limpo': '\033[m', 'vermelho': '\033[1;31m', 'verde': '\033[1;32m', 'azul': '\033[1;34m'} frase = str(input('Digite uma frase: ')).strip().lower() print(f'Quantas vezes aparece a letra A? {cores["vermelho"]}{frase.count("a")}{cores["limpo"]}') print(f'Onde aparece a letra A pela prim...
StarcoderdataPython
6476451
<filename>h3mlcore/models/H3RNNSeqClassifier.py ''' A bidirectional LSTM sequence model used for document classification. It is basically a sequence classification model developed in mxnet. Author: <NAME> Group: Cognitive Security Technologies Institute: Fraunhofer AISEC Mail: <EMAIL> Copyright@2017 ''' import mxnet ...
StarcoderdataPython
1882224
from dreamcoder.program import Primitive, Program from dreamcoder.type import arrow, baseType, tint turtle = baseType("turtle") tstate = baseType("tstate") tangle = baseType("tangle") tlength = baseType("tlength") primitives = ( [ Primitive("logo_UA", tangle, ""), Primitive("logo_UL", tlength, "")...
StarcoderdataPython
1974265
# Copyright 2014 Intel Corporation, All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the"License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or ...
StarcoderdataPython
1958827
<gh_stars>1-10 import unittest import tests if __name__ == "__main__": test_suite = unittest.TestLoader().discover(tests.__name__) runner = unittest.TextTestRunner(verbosity=3) runner.run(test_suite)
StarcoderdataPython
97630
<reponame>chocianowice/weatherQuery import sys import mariadb import time def export_to_db(dbconfig, temperature, weatherCode, windSpeed, windDirection): # Connect to MariaDB Platform try: conn = mariadb.connect( user=dbconfig['username'], password=dbconfig['password'], ...
StarcoderdataPython
1827488
# -------------- # Code starts here # Create the lists class_1 = ['<NAME>','<NAME>','<NAME>','<NAME>' ] class_2 = ['<NAME>','<NAME>','<NAME>'] # Concatenate both the strings new_class = (class_1 + class_2) print (new_class) # Append the list new_class.append('<NAME>') # Print updated list print(new_class) # Rem...
StarcoderdataPython
3570805
# Copyright (c) 2014 mogoweb. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { # A hook that can be overridden in other repositories to add additional # compilation targets to 'All' 'android_app_targets%': [], '...
StarcoderdataPython
367510
<gh_stars>0 # -------------- import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split # Code starts here df = pd.read_csv(path) print(df.head()) print(df.info()) cols = ['INCOME','HOME_VAL','BLUEBOOK','OLDCLAIM','CLM_AMT'] df[cols...
StarcoderdataPython
6648388
# GENERATED BY KOMAND SDK - DO NOT EDIT import komand import json class Component: DESCRIPTION = "Kill or send a signal to the container" class Input: ID = "id" SIGNAL = "signal" class Output: SUCCESS = "success" class ContainerKillInput(komand.Input): schema = json.loads(""" { ...
StarcoderdataPython
9681374
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split import time ### DATA PREPROCESSING ### #Importing data data = pd.read_csv (r'NASDAQ.csv') print (data) print (data['LABEL'].unique().tolist()) #To check number of variables i.e. should be only 2 (0 and1) print(d...
StarcoderdataPython
1972368
<filename>binding/python/test_leopard.py # # Copyright 2018-2022 Picovoice Inc. # # You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE" # file accompanying this source. # # Unless required by applicable law or agreed to in writing, software dist...
StarcoderdataPython
1999270
<gh_stars>0 """Test mixing sources of arguments/settings.""" from os.path import join import pytest from click.testing import CliRunner from sphinxcontrib.versioning.cli import cli from sphinxcontrib.versioning.git import IS_WINDOWS @pytest.fixture(autouse=True) def setup(monkeypatch, local_empty): """Set cli....
StarcoderdataPython
1859699
<filename>python3/42.trapping-rain-water.201502705.ac.py # # @lc app=leetcode id=42 lang=python3 # # [42] Trapping Rain Water # # https://leetcode.com/problems/trapping-rain-water/description/ # # algorithms # Hard (47.69%) # Likes: 6376 # Dislikes: 111 # Total Accepted: 476.5K # Total Submissions: 998.8K # Testc...
StarcoderdataPython
6498211
# This is taken from: # https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5 # i.e. # Detectron2 Tutorial.ipynb from detectron2.utils.visualizer import ColorMode from detectron2.utils.visualizer import Visualizer from detectron2.engine import DefaultPredictor from detectron2.config import get_cfg ...
StarcoderdataPython
391729
"""A layered graph, backed by redis. Licensed under the 3-clause BSD License: Copyright (c) 2013, <NAME> (<EMAIL>) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code m...
StarcoderdataPython
6465256
<reponame>coinForRich/coin-for-rich # This module contains common number helpers from decimal import Decimal from typing import Union def round_decimal( number: Union[float, int, Decimal, str], n_decimals: int=2 ) -> Union[Decimal, None]: ''' Rounds a `number` to `n_decimals` decimals ...
StarcoderdataPython
92835
# -*- coding:utf-8 -*- """Sample training code """ import numpy as np import pandas as pd import argparse import torch as th import torch.nn as nn from sch_qm import SchNetModel # from mgcn import MGCNModel # from mpnn import MPNNModel from torch.utils.data import DataLoader from Alchemy_dataset_qm import TencentAlchem...
StarcoderdataPython
11336408
<reponame>LucasCarioca/split<gh_stars>10-100 import os from typing import Dict, List, Optional DEFINED_ACTION_OUTPUTS_NUMBER = 100 def set_action_output(name: str, value: str): print(f'::set-output name={name}::{value}') def print_action_error(msg: str): print(f'::error file={__name__}::{msg}') def get_...
StarcoderdataPython
6640737
<filename>aop/extensions/searchandreplace.py<gh_stars>1-10 import os from distutils.util import strtobool from aop.aop import extends search_and_replace = bool(strtobool(os.getenv("USE_SEARCH_AND_REPLACE"))) if search_and_replace: print("Using feature: Search and replace") @extends('feature_states') def ...
StarcoderdataPython
3429803
''' Created on 26 juil. 2017 @author: worm ''' from django.urls.base import reverse from snapshotServer.tests.views.Test_Views import TestViews class Test_TestListView(TestViews): def test_test_exists(self): """ Simple test to show that we get all test cases from session """ re...
StarcoderdataPython
3469448
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse from django.views.generic import DetailView from django.views import View from django.db.models import Q from django.conf import settings from django.template.loader import render_to_string from django.shortcuts import get_object_or_404, render fr...
StarcoderdataPython
196178
import re from collections import defaultdict from django.db import migrations def add_users_to_groups_based_on_users_permissions(apps, schema_editor): """Add every user to group with "user_permissions" if exists, else create new one. For each user, if the group with the exact scope of permissions exists, ...
StarcoderdataPython
4929469
<reponame>CrankySupertoon01/Toontown-2<filename>toontown/estate/GardenGameGlobals.py acceptErrorDialog = 0 doneEvent = 'game Done' colorRed = (1, 0, 0, 1) colorBlue = (0, 0, 1, 1) colorGreen = (0, 1, 0, 1) colorGhostRed = (1, 0, 0, 0.5) colorGhostGreen = (0, 1, 0, 0.5) colorWhite = (1, 1, 1, 1) colorBlack = (0.5, 0.5, ...
StarcoderdataPython
3389784
import os import sys import atexit def daemon(pid_file=None): if os.path.exists("/Users/admin/devops/socket_uvloop/{0}".format(pid_file)): raise RuntimeError("Already running") pid = os.fork() if pid: sys.exit(0) os.chdir('/') # 子进程默认继承父进程的umask(文件权限掩码),重设为0(完全控制),以免影响程序读写文件 ...
StarcoderdataPython
3527837
from discord.ext import commands import discord from discord_slash import SlashContext from discord_slash.cog_ext import cog_slash as slash from discord_slash.utils.manage_commands import create_option from utils import command_option_type from helpers import programmes_helper from services import offers_service import...
StarcoderdataPython
2868
<reponame>Andy-Wilkinson/ChemMLToolk import tensorflow as tf class VariableScheduler(tf.keras.callbacks.Callback): """Schedules an arbitary variable during training. Arguments: variable: The variable to modify the value of. schedule: A function that takes an epoch index (integer, indexed ...
StarcoderdataPython
12838347
<reponame>kanson1996/IIMS #!/usr/bin/python3 # -*- coding: utf-8 -*- """ Created by Kanson on 2020/1/12 16:03. """ import random import datetime def tid_maker(): a = int (datetime.datetime.now ().timestamp ()) b = int (''.join ([str (random.randint (0, 9)) for i in range (3)])) a = str (a) b = str (...
StarcoderdataPython
64565
from brownie import reverts from fixtures import setup_wallet, owners_2 from eth_abi import encode_abi from web3 import Web3 from fixtures import ACCOUNTS from eth_account.messages import encode_defunct def calculate_transaction_hash(nonce: int, to: str, value: int, data: str='00'): encoded: bytes = nonce.to_byte...
StarcoderdataPython
8022562
import yaml from beanstalkio.connection import Connection from beanstalkio.errors import CommandError class Client: def __init__(self, host, port): self.connection = Connection(host, port) def _send_command(self, command): self.connection.write(command) def _read_server_response(self): ...
StarcoderdataPython
6570729
""" Tools for testing this library the name begins with an underscore so that the functions aren't run as tests """ import time import contextlib import joblib import numpy as np import nose.tools from nose.plugins.attrib import attr eq_ = nose.tools.eq_ # for compatibility # TODO rename to assert_equal and all o...
StarcoderdataPython
389398
"""AppleByte database support.""" from cryptoassets.core import models from cryptoassets.core.coin.registry import CoinModelDescription from cryptoassets.core.coin.validate import HashAddresValidator coin_description = CoinModelDescription( coin_name="aby", wallet_model_name="cryptoassets.core.coin.applebyte....
StarcoderdataPython
11293040
<filename>lms/views/reports.py from pyramid.view import view_config from lms.models import ApplicationInstance, LtiLaunches @view_config( route_name="reports", renderer="lms:templates/reports/application_report.html.jinja2", permission="view", ) def list_application_instances(request): launches = req...
StarcoderdataPython
1986504
<gh_stars>0 __author__ = 'Andy' import time from whirlybird.server.position_contoller import PositionController if __name__ == "__main__": position_controller = PositionController() position_controller.run() time.sleep(10) position_controller.kill()
StarcoderdataPython
5101387
<gh_stars>100-1000 #!/usr/bin/env python """ Kernels. Authors: - <NAME>, 2012 (<EMAIL>) - <NAME>, 2016 (<EMAIL>) Copyright 2016, Mindboggle team (http://mindboggle.info), Apache v2.0 License """ def rbf_kernel(x1, x2, sigma): """ Compute normalized and unnormalized graph Laplacians. Paramet...
StarcoderdataPython
11323764
r"""Perform continuous measure record. The gRPC API is built from the C API. NI-DCPower documentation is installed with the driver at: C:\Program Files (x86)\IVI Foundation\IVI\Drivers\niDCPower\Documentation\NIDCPowerCref.chm Getting Started: To run this example, install "NI-DCPower Driver" on the server machine:...
StarcoderdataPython
4803294
#!/usr/bin/env python u""" nsidc_subset_altimetry.py Written by <NAME> (07/2018) Program to acquire and plot subsetted NSIDC data using the Valkyrie prototype CALLING SEQUENCE: to use a bounding box: python nsidc_subset_altimetry.py --bbox=-29.25,69.4,-29.15,69.50 ILVIS2 to use start and end time: python nsid...
StarcoderdataPython
9737345
#!/usr/bin/env python # # This script is being used to find the deeply hidden bug in the move generator! # # It attempts to generate a position where ccore's perftdiv (at depth 1) is different # to that given by critter. # # usage: find_buggy_pos.py [number|filename] # If filename is specified then FENs are re...
StarcoderdataPython
3327636
#!/bin/python # path to python # where is your writable directory? Jobs will be managed in a .queue directory here. SCRATCH="FULL_PATH_TO_YOUR_SCRATCH_SPACE" # username USER="YOUR_USERNAME_HERE" # how big is one batch of jobs? ex 10 means there must be 10 free slots to run another batch. JOB_ARRAY_MAX=20 # max tota...
StarcoderdataPython
191070
<reponame>schallerdavid/perses from perses.bias.bias_engine import *
StarcoderdataPython
11212771
import logging from scout.models.hgnc_map import HgncGene LOG = logging.getLogger(__name__) def build_phenotype(phenotype_info): phenotype_obj = {} phenotype_obj["mim_number"] = phenotype_info["mim_number"] phenotype_obj["description"] = phenotype_info["description"] phenotype_obj["inheritance_model...
StarcoderdataPython
1855421
<reponame>danielfranca/find_duplicate_content from pipeline_lib.pipeline import build_structure from pipeline_lib.pipeline import get_duplicated_content from pipeline_lib.pipeline import generate_content_hash from pipeline_lib.pipeline import run_next_action from pipeline_lib.utils import save_state import unittest fro...
StarcoderdataPython
27620
<filename>Neural Network/NNToyFx/python/activations.py<gh_stars>0 from simulation import * def relu(ctx: SimulationContext, x: Connection): relu1 = ctx.max(x, ctx.variable(0)) return relu1
StarcoderdataPython
4833554
# coding=utf-8 # python imports from __future__ import unicode_literals, print_function from ardy.core.triggers.driver import Trigger from ardy.utils.log import logger class Driver(Trigger): _DEPLOY_KEYS_WHITELIST = ["Id", "LambdaFunctionArn", "Events", "Filter"] _LAMBDA_ARN_KEY = "LambdaFunctionArn" g...
StarcoderdataPython
5044702
import json from typing import Optional import pulumi_aws as aws import pulumi_random as random from infra.config import LOCAL_GRAPL import pulumi class JWTSecret(pulumi.ComponentResource): """ Represents the frontend's JWT secret stored in Secretsmanager. """ def __init__(self, opts: Optional[pulumi.Resou...
StarcoderdataPython
9737859
import re from markdown.inlinepatterns import Pattern from markdown.preprocessors import Preprocessor from markdown.extensions import Extension from markdown.util import etree, AtomicString class HintedWikiLinkExtension(Extension): def extendMarkdown(self, md, md_globals): md.inlinePatterns.add("hintedwi...
StarcoderdataPython
1990299
import numpy as np import matplotlib.pyplot as plt np.random.seed(42) X = 2*np.random.rand(100, 1) y = 4+3*X+np.random.randn(100, 1) X_b = np.c_[np.ones((100, 1)), X] X_new = np.array(([0], [2])) X_new_b = np.c_[np.ones((2, 1)), X_new] t0, t1 = 5, 50 # learning schedule hyperparameter def learning_schedule(t): ...
StarcoderdataPython
6490083
# # Create different sounds with a buzzer # # Credit for star wars song: https://gist.github.com/mandyRae/459ae289cdfcf6d98a6b import time import numpy as np import RPi.GPIO as GPIO sound_pin = 12 GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(sound_pin, GPIO.OUT) GPIO.output(sound_pin, 0) tone1 = GPIO...
StarcoderdataPython
5061696
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with t...
StarcoderdataPython
1718077
<reponame>SkygearIO/py-skygear<gh_stars>1-10 # -*- coding: utf-8 -*- # # -- General configuration ----------------------------------------------------- import sphinx_rtd_theme import os import sys from pkg_resources import find_distributions from email import message_from_string directory = os.path.join(os.path.dirnam...
StarcoderdataPython
8042855
from setuptools import setup, find_packages setup( name='django-jalali', version='4.0.0', packages=find_packages(), include_package_data=True, zip_safe=False, description=("Jalali Date support for Django model and admin interface"), url='http://github.com/slashmili/django-jalali', downl...
StarcoderdataPython
11229671
import ast import json import os import random from django.core import serializers from django.core.cache import cache from blog.models import Post from commons.emoji import EMOJI from constants import KEYS, CAPS from survey import survey def add_emoji(**args): return [{ "thinking_emoji": ''.join(EMOJI["...
StarcoderdataPython
8177181
import os from setuptools import setup, find_packages from setuptools.extension import Extension from Cython.Build import cythonize import Cython.Compiler.Options Cython.Compiler.Options.annotate = True extensions = cythonize([ Extension( "skroute.heuristics.brute._base_brute_force._base_brute_force", ...
StarcoderdataPython
9664108
from es_connection import es_connect import pandas as pd import iso8601 import datetime as dt from hashlib import sha1 from es_request_total_json import json_query from es_request_protocol_json import json_protocol_query from es_request_external_json import json_external_query from es_request_2tags_3aggs_json import ...
StarcoderdataPython
8067380
import os from defcon import Font def combineGlyphs(path1, path2, destPath): """ Combines the glyphs of two UFOs and saves result to a new ufo. This only combines glyphs, so the first UFO path should be the one that you want all the metadata from. """ ufo1 = Font(path1) ufo...
StarcoderdataPython
11352740
<reponame>JHP4911/Quantum-Computing-UK from qiskit import QuantumRegister, ClassicalRegister from qiskit import QuantumCircuit, execute,IBMQ from qiskit.tools.monitor import job_monitor from qiskit.circuit.library import QFT import numpy as np pi = np.pi IBMQ.enable_account(‘ENTER API KEY HERE’) provider = IBMQ.get_p...
StarcoderdataPython
254893
import numpy as np def filter_directionality(prq, list_veh_obj, nr_best_veh, routing_engine, selected_veh): """This function filters the nr_best_veh from list_veh_obj according to the difference in directionality between request origin and destination and planned vehicle route. Vehicles with final position eq...
StarcoderdataPython
6669856
import utils.processing as proc import numpy as np import utils.template_match_target as tmt from keras.models import load_model import pandas as pd import h5py ######################## def get_metrics(data, craters, dim, model, beta=1): """Function that prints pertinent metrics at the end of each epoch. Param...
StarcoderdataPython
9621487
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 10 11:05:53 2021 @author: alef """ # String unicode u = u'<NAME>' print(u, type(u)) # Convertendo para str s = u.encode('latin1') print(s, '=>', type(s)) t = s.decode('latin1') print(t, ' => ', type(t))
StarcoderdataPython