id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
4814382
<gh_stars>1-10 import os import satori import ravencoin.base58 from ravencoin.wallet import P2PKHRavencoinAddress, CRavencoinSecret class Wallet(): def __init__(self): self._entropy = None self._privateKeyObj = None self._addressObj = None self.address = None self.scrip...
StarcoderdataPython
3251512
__author__ = '<NAME>' """ This file contains the parameters for sensors with different levels of accuracy. Use this when generating the configuration file. Particularly, it contains the following types of sensors: - IDEAL: the ideal volume and flow sensor - RADARI57: the radar sensor with similar performance ...
StarcoderdataPython
1635095
import torch from torch import nn from torchvision import models def save_checkpoint(model, training_dataset, arch, epochs, lr, hidden_units, input_size): model.class_to_idx = training_dataset.class_to_idx checkpoint = {'input_size': (3, 224, 224), 'output_size': 102, 'hidd...
StarcoderdataPython
1608986
#!/usr/bin/env python """ Script that lists recent users To be called from a cron job. """ from sortedcontainers import SortedList from zeeguu.core.model import User, Bookmark from wordstats import Word user = User.find_by_id(1890) language = 'nl' months_dict = dict() for bookmark in Bookmark.query.filter...
StarcoderdataPython
3366423
<filename>leetcode/isomorphic_strings.py # https://leetcode.com/problems/isomorphic-strings/ import collections class Solution: # @param {string} s # @param {string} t # @return {boolean} def isIsomorphic(self, s, t): ss = collections.OrderedDict() tt = collections.OrderedDict() ...
StarcoderdataPython
1606063
<filename>release/sanity_checks.py #!/usr/bin/env python # encoding: utf-8 """ releaseutils.py This contains no main method only utility functions to run sanity checks on the Checker Framework. Created by <NAME> 11/21/2012 Copyright (c) 2012 University of Washington """ from release_vars import * from release_utils...
StarcoderdataPython
1666638
def is_divisible(num): if num == 1: return True dividers = [2, 3, 5] for div in dividers: if num % div == 0: return True return False need_index = int(input()) result = 1 i = 0 n = 1 while i != need_index: if is_divisible(n): result = n ...
StarcoderdataPython
4839143
DEBUG = False SECRET_KEY = 'ENTER YOU KEY HERE' SQLALCHEMY_DATABASE_URI = 'sqlite:///db/glimpses.db' SESSION_PERMANENT = False
StarcoderdataPython
1799128
from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import render from evaluator.models import Task, Applicant @login_required def profile(request): tasks = Task.objects.filter(applicant=request.user.applicant) context = { 'tasks': tasks,...
StarcoderdataPython
3260407
<reponame>timostrunk/UNICOREDaemonCerts # -*- coding: utf-8 -*- import abc from six import string_types import logging import yaml import yaml.constructor from ast import literal_eval # Abstract Settings base class, handles both a settings format and a commandline parser # Override _set_defaults in child class # To ...
StarcoderdataPython
1774410
<reponame>NationalJournal/chargify-python<gh_stars>0 from .chargify import *
StarcoderdataPython
1762356
<filename>gctf/__init__.py from .version import __version__ from .centralized_gradients import get_centralized_gradients from .centralized_gradients import centralized_gradients_for_optimizer from .optimizers import *
StarcoderdataPython
3251182
#! /usr/bin/env python import os import sys import select import time import math import getopt import RPi.GPIO as GPIO # Debug flag debug = False def Usage(): print('Usage: stepper.py -d -h -v --debug --help --version degrees timing-in-milliseconds') # Stepper motor operation -- 28BYJ48 5V DC motor # 32 teeth ...
StarcoderdataPython
100697
<reponame>revensky/psion import unittest from psion.jose.exceptions import InvalidJWSHeader, UnsupportedAlgorithm from psion.jose.jwk import JsonWebKey from psion.jose.jws import JsonWebSignature, JsonWebSignatureHeader from tests.jose.utils import load_json class TestJsonWebSignatureHeader(unittest.TestCase): ...
StarcoderdataPython
1714558
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() def read_requirements(): with open('requirements.txt') as req: content = req.read() requirements = content.split('\n') return requirements setuptools.setup( name="deeplearn", vers...
StarcoderdataPython
3296759
<reponame>patrick-hudson/python-flask-ping<filename>app.py #!/home/tracert/.virtualenvs/python-flask-ping/bin/python from flask import Flask, render_template, request, jsonify from flask.ext.cors import CORS from werkzeug.routing import BaseConverter import pyping app = Flask(__name__) CORS(app) statusPing = 0 class Re...
StarcoderdataPython
1745258
<gh_stars>1-10 import sys import os from shutil import copyfile from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix p_log_file = 'log_20/log_train_flow_K3_gamma1_B128_E64.txt' def set_log_file(log_filename): global p_log_file p_log_file = log_filename if os.path...
StarcoderdataPython
56495
<reponame>dpttw/SEMimage<gh_stars>0 # by <NAME> from pymongo import MongoClient MONGO_MGI_USER = "mgi_user" MONGO_MGI_PASSWORD = "<PASSWORD>" MGI_DB = "mgi" MONGODB_URI = "mongodb://" + MONGO_MGI_USER + ":" + MONGO_MGI_PASSWORD + "@localhost/" + MGI_DB def _connect(): """ Connect to the database :return...
StarcoderdataPython
1777576
import os from shutil import copyfile import pandas as pd import numpy as np from configuration.paths import * SEED = 1 def normalize(ds): ds = ds.groupby("patientId", as_index=False).sum() ds['diagnosis'] = np.where(ds['Target'] >= 1, 1, 0) ds = ds.rename(columns={'patientId': 'image'}) ds = ds[['...
StarcoderdataPython
3389462
<filename>djq/lib/djq/variables/cv_dreq_example.py<gh_stars>1-10 # (C) British Crown Copyright 2016, Met Office. # See LICENSE.md in the top directory for license details. # """An attempt at computing variables based on examples in the dreq. """ # This is a back end for djq.variables.compute, and is where we # actual...
StarcoderdataPython
194158
#!/usr/bin/env python # -*- coding: utf-8 -*- # =============================================================== # Copyright (C) 2019 HuangYk. # Licensed under The MIT Lincese. # # Filename : optic_flow_loader.py # Author : HuangYK # Last Modified: 2019-07-16 21:41 # Description : # =========================...
StarcoderdataPython
197105
<filename>awsparams/__init__.py # Copyright 2016 Brigham Young University # # 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 require...
StarcoderdataPython
125773
<reponame>LuckyLuuk035/Monte-Carlo_Luuk-Bouwman class VoetbalClub: """ VoetbalClub is een simpele class. Gemaakt om het aantal punten van de clubs bij te kunnen houden. """ def __init__(self, naam): self.naam = naam self.punten = 0
StarcoderdataPython
3317392
<reponame>GraySilver/pandas-files from pandasfiles.base.setting import Setting class Distribution(Setting): pass
StarcoderdataPython
175702
from django.shortcuts import redirect def logout(request): request.session.flush() return redirect("login")
StarcoderdataPython
3265491
from random import randint, random, uniform, choice from .problem import Problem from .algorithm_genetic import GeneralEvolutionaryAlgorithm from .operators import RandomGenerator, PmMutator, ParetoDominance, EpsilonDominance, crowding_distance, \ NonUniformMutation, UniformMutator, CopySelector from .archive impor...
StarcoderdataPython
1675827
"""Tests for the xapi module of the Marsha project.""" from unittest import mock from django.test import TestCase, override_settings from rest_framework_simplejwt.tokens import AccessToken from ..defaults import RAW, RUNNING from ..factories import DocumentFactory, VideoFactory from ..xapi import ( XAPI, XAP...
StarcoderdataPython
3206207
#最大回撤 import numpy as np import matplotlib.pyplot as plt x = [32,35,22,188,32,34,23,21,192,43] j = np.argmax(np.maximum.accumulate(x) - x) print('j is {0}'.format(j)) print(np.maximum.accumulate(x)) print(np.maximum.accumulate(x) - x) i = np.argmax(x[:j]) print('i is {0}'.format(i)) d = x[i] - x[j] plt.plot(x) plt.plo...
StarcoderdataPython
3286525
<gh_stars>1-10 #!/usr/bin/env python from csvkit import CSVKitReader from csvkit.cli import CSVKitUtility class CSVLook(CSVKitUtility): description = 'Render a CSV file in the console as a fixed-width table.' override_flags = 'l' def add_arguments(self): pass def main(self): rows = ...
StarcoderdataPython
3264210
<reponame>AmirDJV/HyPyP<gh_stars>0 #!/usr/bin/env python # coding=utf-8 # ============================================================================== # title : getting_started.py # description : Demonstration of PyPyP basics. # author : <NAME> # date : 2020-03-18 # version :...
StarcoderdataPython
75618
<filename>recipes/examples/scif.py<gh_stars>100-1000 """ Build the CUDA-STREAM benchmark for multiple CUDA compute capabilities. Make each build available as a SCI-F application. """ Stage0 += baseimage(image='nvcr.io/nvidia/cuda:9.1-devel-centos7', _as='devel') # Install the GNU compiler Stage0 += gnu(fortran=False)...
StarcoderdataPython
1757283
#////********************************************************* #// <copyright file="BioDebug.py" company="Microsoft"> #// Copyright (c) Microsoft. All rights reserved. #// </copyright> #// <summary>This is meant to be run by ipy.exe to build the Bio.IronPython dll, copy the other necessary #// files to bin\Debug, a...
StarcoderdataPython
1777690
# -*- coding: utf-8 -*- from django.core.mail import send_mail from django.core.mail import mail_admins from django.template.loader import render_to_string from django.template import Context, Template from django.conf import settings from beauty_and_pics.consts import project_constants from itertools import chain imp...
StarcoderdataPython
4820769
<gh_stars>0 # The correct function """ After viewing some cols and their values we've found it's wiser to make some changes to make the processing easier """ import pandas as pd import datetime """ correct takes as params the path to the dataset, the col of dates in our dataset as well as its the new datetime col tran...
StarcoderdataPython
112218
<filename>rinse.py<gh_stars>0 #!python """ Habit tracker written in python 3.6 """ import argparse def parse_args(): """Parses arguments params: returns: """ parser = argparse.ArgumentParser() parser.add_argument( 'mode', help=''' Determines which other bits to call...
StarcoderdataPython
3305836
''' Urban-PLUMBER processing code Associated with the manuscript: Harmonized, gap-filled dataset from 20 urban flux tower sites Copyright (c) 2021 <NAME> Licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 ''' __title__ =...
StarcoderdataPython
1767632
# QUESTION : LONGEST MOUNTAIN SUBARRAY. # DESCRIPTION: In this question we have to find the max length of subarray which is a mountain. # Approach : The basic condition for a subarray to be a mountain is that there should be a peak (a largest element). # We can find the peak , and then iterate to the left and to right...
StarcoderdataPython
3203407
<filename>day_06.py """ Day Six - Sets (intersection) """ import utils if __name__ == '__main__': lines = utils.read_strings_from_lines("in/day_06.txt", strip=False) lines.append("\n") groups = [] current_people = [] for line in lines: if line == "\n": groups.append(set.inte...
StarcoderdataPython
3339466
import threading import sys import DobotDllType as dType import time # Turn Conveyor On STEP_PER_CIRCLE = 360.0 / 1.8 * 10.0 * 16.0 MM_PER_CIRCLE = 3.1415926535898 * 36.0 vel = float(50) * STEP_PER_CIRCLE / MM_PER_CIRCLE CON_STR = { dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError", dType.Dobo...
StarcoderdataPython
147778
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('facilities', 'update_export_facilities_material_view'), ] operations = [ migrations.AddField( model_name='facili...
StarcoderdataPython
129424
<reponame>kachayev/crafter import datetime import json import pathlib import imageio import numpy as np class Recorder: def __init__( self, env, directory, save_stats=True, save_video=True, save_episode=True, video_size=(512, 512)): if directory and save_stats: env = StatsRecorder(env, direc...
StarcoderdataPython
1613919
<reponame>sdrdl/sdrdl-ambry-bundles<filename>sandiegodata.org/places/bundle.py<gh_stars>0 ''' ''' from ambry.bundle import BuildBundle class Bundle(BuildBundle): ''' ''' def build(self): self.build_places() self.build_geo_cross() return True def build_places(self): ...
StarcoderdataPython
1631785
<gh_stars>1-10 from .logger import logger from functools import wraps def deprecated(f): @wraps(f) def decorated(*args, **kwargs): logger.critical(f"{f.__name__} is deprecated and will be removed in the future") return f(*args, **kwargs) return decorated
StarcoderdataPython
1766156
import argparse from typing import List from protobufs.institution.coldwallet_pb2 import DESCRIPTOR from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from coldwallet.servicer import ColdWalletServicer from coldwallet.sql.base import Base from coldwallet.utils.cm_scoped_session_factory impor...
StarcoderdataPython
135354
<gh_stars>1-10 # Generate a simple Latex table from IPython.display import display, Latex # data as tuple, data_titles as tuple, precision as tuple in same order as data, # shape = 'hor' or 'ver', box = 'hor' or 'ver' or 'full' or 'none' # precision values should be str with only 1 decimal, so: '3.5f', '.3i', '.f', e...
StarcoderdataPython
91564
<gh_stars>1-10 import os import re from dataclasses import dataclass, field from pathlib import Path from tempfile import TemporaryFile from typing import Dict, List, Optional, Set from uuid import UUID, uuid4 import openslide import pyvips import tifffile from django.conf import settings from django.core.exceptions i...
StarcoderdataPython
1736513
<reponame>lokal-profil/pywikibot-sdc<gh_stars>1-10 #!/usr/bin/python # -*- coding: utf-8 -*- """Common functions not specifically related to batchuploads or wiki.""" from __future__ import unicode_literals # avoid having to use from past.builtins import basestring try: basestring # attempt to evaluate basestring...
StarcoderdataPython
3264073
#!/usr/bin/env python3 """ Defines various functions useful for image processing tasks common to epubs. """ from pathlib import Path import tempfile import regex from PIL import Image, ImageMath import se import se.formatting def _color_to_alpha(image: Image, color=None) -> Image: """ Implements GIMP's color to ...
StarcoderdataPython
3223780
<filename>os_refresh_config/tests/test_os_refresh_config.py # Copyright 2014 Red Hat, 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 #...
StarcoderdataPython
124734
import Adafruit_BBIO.GPIO as GPIO import time BB_LED1_Pin = "P8_14" BB_LED2_Pin = "P8_16" BB_LED3_Pin = "P8_18" BB_LED1 = False BB_LED2 = False BB_LED3 = False GPIO.setup(BB_LED1_Pin, GPIO.OUT) GPIO.setup(BB_LED2_Pin, GPIO.OUT) GPIO.setup(BB_LED3_Pin, GPIO.OUT) BB_DO1_Pin = "P9_25" BB_DO2_Pin = "P9_27" BB_DO1 = Fa...
StarcoderdataPython
1609356
<filename>rpython/memory/gctransform/log.py import py from rpython.tool.ansi_print import ansi_log log = py.log.Producer("gctransform") py.log.setconsumer("gctransform", ansi_log)
StarcoderdataPython
1794924
# -*- coding: utf-8 -*- """ Common task with image data. ================================== 20.07.20. Conversion to QImage and QPixmap """ __author__ = '<NAME>' __email__ = '<EMAIL>' __all__ = ['to_q_image', 'to_q_pixmap'] from PySide2.QtGui import QImage, QPixmap import numpy as np def to_q_image(ima...
StarcoderdataPython
199607
from genolake.tahoe.test import SparkTestCase from genolake.tahoe.features import * from genolake.adam.adamContext import ADAMContext class FeatureTest(SparkTestCase): def test_visualize_features(self): # load file ac = ADAMContext(self.ss) testFile = self.resourceFile("smalltest.bed") ...
StarcoderdataPython
4804666
<gh_stars>0 import rospy from yaw_controller import YawController from pid import PID from lowpass import LowPassFilter import math GAS_DENSITY = 2.858 ONE_MPH = 0.44704 class Controller(object): def __init__(self, vehicle_mass, fuel_capacity, brake_deadband, decel_limit, accel_limit, wheel_radius, wheel_base, ...
StarcoderdataPython
126654
import requests import json from datetime import datetime import pysnowball.token as token def fetch(url, host="stock.xueqiu.com"): HEADERS = {'Host': host, 'Accept': 'application/json', 'Cookie': token.get_token(), 'User-Agent': 'Xueqiu iPhone 11.8', '...
StarcoderdataPython
1782604
<filename>Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/python/topi/vision/nms.py # pylint: disable=invalid-name, no-member, too-many-locals, too-many-arguments """Non-maximum suppression operator""" import tvm from tvm import api def nms_ir(data, sort_result, valid_count, out, nms_threshold, forc...
StarcoderdataPython
85466
<filename>list_albums.py<gh_stars>0 from datetime import datetime, timezone from addict import Dict as Addict from api_auth import auth_flickr flickr = auth_flickr() def get_albums(): return _get_album_page(1, []) def _get_album_page(page, acc): search_result = Addict(flickr.photosets.getList(page=page))...
StarcoderdataPython
1638597
<reponame>PeterouZh/pytorch-lightning import pytest from pytorch_lightning import Trainer from pytorch_lightning.examples.new_project_templates.lightning_module_template import LightningTemplateModel from argparse import Namespace from test_tube import Experiment from pytorch_lightning.callbacks import ModelCheckpoint ...
StarcoderdataPython
184705
from pepnet.encoder import Encoder from nose.tools import eq_ import numpy as np def test_encoder_index_lists(): encoder = Encoder() S_idx = encoder.index_dict["S"] A_idx = encoder.index_dict["A"] index_lists = encoder.encode_index_lists(["SSS", "AAA", "SAS"]) eq_(index_lists, [ [S_idx, S_i...
StarcoderdataPython
1732851
<reponame>jaraco/jaraco.site collect_ignore = ['fabfile.py']
StarcoderdataPython
1625021
<reponame>pmjherman/CoralModel<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Fri Sep 24 11:36:48 2021 @author: herman """ import netCDF4 import os import matplotlib.pyplot as plt import numpy as np plt.style.use('seaborn-whitegrid') # NetCDF4-Python can read a remote OPeNDAP dataset or a local NetCDF file: out_d...
StarcoderdataPython
3290188
import boto3 import json from storage.memcached import memcached_operator def handler(event, context): function_name = "lambda_core" # dataset setting dataset_name = 'higgs' data_bucket = "higgs-10" dataset_type = "dense_libsvm" n_features = 30 host = "127.0.0.1" por...
StarcoderdataPython
1635977
from os import stat import toml class InputFile: """Represent the toml input file.""" def __init__(self, input_f): self.data = self._load(input_f) @staticmethod def _validate(data): """Validate if the fields are correct.""" # FIXME: Implement! pass @staticmethod ...
StarcoderdataPython
3303241
<reponame>awohlford/vault-master<filename>src/lib/ImportExport.py import sys import json """ Adding import or export formats: To add an import or export format, you need to add a file format name to `self.importItems()` or `self.export()` and create an associated method called `importFrom[SomeFormat]...
StarcoderdataPython
1696339
<reponame>toandaominh1997/TrafficSignDetection<gh_stars>1-10 import os import cv2 import pandas as pd import numpy as np import torch import torch.nn as nn from albumentations.pytorch.transforms import ToTensorV2 import albumentations as A import json import glob import random SEED = 42 def seed_everything(seed): ...
StarcoderdataPython
188774
from .QualifiedName import QualifiedName from .Key import Key class Eko: def __init__(self, imports, dictionary): self.imports = imports self.dictionary = dictionary self.resolve_reference(self.dictionary) self.collapsed = self.get_collapsed(self.dictionary) print("==E...
StarcoderdataPython
3278736
import unittest import numpy as np import pandas as pd from pyalink.alink import * class TestPinyi(unittest.TestCase): def test_pca(self): data = np.array([ ["1.0 2.0 4.0", "a"], ["-1.0 -3.0 4.0", "a"], ["4.0 2.0 3.0", "b"], ["3.4 5.1 5.0", "b"] ]...
StarcoderdataPython
63166
from datetime import datetime def execution_time(func): def wrapper(*args, **kwargs): # *args and **kwargs --> Doesn't matter the number of arguments # or key arguments gived to the nested function initial_time = datetime.now() func(*args, **kwargs) f...
StarcoderdataPython
3352998
<filename>tests/test_output.py # -*- encoding: utf-8 -*- from __future__ import unicode_literals from .utils import test_print_tree, get_complete_binary_tree def test_output(): expected = """\     ┌0   ┌0┤   │ └0 ┌0┤ │ │ ┌0 │ └0┤ │   └0 0┤ │   ┌0 │ ┌0┤ │ │ └0 └0┤   │ ┌0   └0┤     └0 """ p =...
StarcoderdataPython
3205919
# -*- coding: utf-8 -*- """ 第 0011 题: 敏感词文本文件 filtered_words.txt,里面的内容为以下内容, 当用户输入敏感词语时,则打印出 Freedom,否则打印出 Human Rights。 北京 程序员 公务员 领导 牛比 牛逼 你娘 你妈 love sex jiangge """ word_filter=set() with open('source/0011/filtered_words.txt') as f: for w in f.readlines(): word_filter.add(w.strip()) while True: s=i...
StarcoderdataPython
1721187
<reponame>yangyaojia/Java-Learn<filename>copydir/copydir/src/main/java/com/copydir/k.py import requests import random import time from contextlib import closing import os import moviepy.editor as mv class Download(object): def __init__(self,name,url,path,unit,headers = None): self.info = "【%s】 %s %.2f%...
StarcoderdataPython
1750347
import sys import ptvsd ptvsd.enable_attach((sys.argv[1], sys.argv[2])) ptvsd.wait_for_attach() try: raise ArithmeticError('Hello') except Exception: pass sys.stdout.write('end')
StarcoderdataPython
1702617
""" Algorithme A1 """ note_option = float(input("saisir la note d'option :")) if note_option < 10: points_gagnes=0 else: points_gagnes=note_option - 10 points_gagnes=points_gagnes*2 print("note d'options :", note_option) print("points gagnés :", points_gagnes) """ Algorithme A2 """ francais = float(in...
StarcoderdataPython
15739
# -*- coding: utf-8 -*- import os, sys from PyQt5.QtWidgets import (QWizard, QMessageBox) from PyQt5.QtGui import QPixmap from PyQt5.QtCore import pyqtSlot, Qt try: import odmltables have_odmltables = True except: have_odmltables = False from .settings import Settings class OdmltablesWizard(QWizard): ...
StarcoderdataPython
198429
""" A unit test for function_caller in function_caller and for synthetic functions in utils.euclidean_synthetic_functions.py -- <EMAIL> """ # pylint: disable=invalid-name # pylint: disable=no-member import numpy as np # Local imports from ..utils import euclidean_synthetic_functions as esf from ..utils.base_tes...
StarcoderdataPython
3297036
####!/usr/bin/env python #------------------------------ """ Class :py:class:`DCBase` is a base class for the Detector Calibration (DC) project ================================================================================== Usage:: # Import from PSCalib.DCBase import DCBase o = DCBase() # Diction...
StarcoderdataPython
72091
config["LOWEST_CPU"] = "arm11mpcore" config["ENABLE_HARD"] = get_yes_no("Enable VFP ABI", True) if not config["ENABLE_HARD"]: config["ENABLE_THUMB"] = get_yes_no("Enable Thumb") import sys sys.argv=["","kernel/mmaps/3ds11.mc"] from buildtools import mmapcomp
StarcoderdataPython
1624806
<reponame>13rianlucero/CrabAgePrediction<gh_stars>1000+ """Module for reading TFM (TeX Font Metrics) files. The TFM format is described in the TFtoPL WEB source code, whose typeset form can be found on `CTAN <http://mirrors.ctan.org/info/knuth-pdf/texware/tftopl.pdf>`_. >>> from fontTools.tfmLib import TFM >>> tfm ...
StarcoderdataPython
3296629
<reponame>sebtelko/pulumi-azure-native<filename>sdk/python/pulumi_azure_native/elastic/v20200701preview/_inputs.py # 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...
StarcoderdataPython
1681714
<reponame>LaudateCorpus1/oci-python-sdk # coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.ap...
StarcoderdataPython
3292630
<filename>cdp/network.py # DO NOT EDIT THIS FILE! # # This file is generated from the CDP specification. If you need to make # changes, edit the generator and regenerate all of the modules. # # CDP domain: Network from __future__ import annotations from cdp.util import event_class, T_JSON_DICT from dataclasses import ...
StarcoderdataPython
55443
<reponame>AntonioMM8506/AlgoExpert def getNthFib(n): if(n==1): return 0 elif (n==2): return 1 else: return getNthFib(n-1) + getNthFib(n-2) #End of getNthFib if __name__ == '__main__': print(getNthFib(6))#5 print(getNthFib(7))#8 print(getNthFib(1))#0 print(getNthFib(...
StarcoderdataPython
3241728
# -*- coding: utf-8 -*- import babel.dates from dateutil.relativedelta import relativedelta import itertools import json from odoo import fields, _, models from odoo.tools import float_round from odoo.tools.misc import get_lang from odoo.addons.web.controllers.main import clean_action DEFAULT_MONTH_RANGE = 3 class...
StarcoderdataPython
92773
<gh_stars>0 from typing import List from collections import Counter class Solution: def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: count1 = Counter(nums1); count2 = Counter(nums2) n1 = set(nums1); n2 = set(nums2); inter = n1.intersection(n2) ans = [] for i in i...
StarcoderdataPython
3265646
<reponame>meadiode/flappy from flappy.geom import Rectangle from flappy.display import DisplayObjectContainer class Sprite(DisplayObjectContainer): def __init__(self, name=None): DisplayObjectContainer.__init__(self, name) def startDrag(self, lock_center=False, bounds=None): if self.stage: ...
StarcoderdataPython
3242331
from datetime import date, timedelta from django.db.models import Count, Q, Avg from django.db.models.functions import TruncMonth from extlinks.links.models import LinkEvent from logging import getLogger logger = getLogger('django') def get_date_count(dates, check_date): """ Find the number of events on a...
StarcoderdataPython
3230708
<gh_stars>0 #!/usr/bin/python # 3----2------2 # /| /| # A | B | A=10 B=11 # / | / | # 7---+-6-----6 1 # | 3 | | # | | | | # | | 5 |<-back # 7 0----0--+---1 # | / | / # | 8 | 9 # |/ |/ # 4-----4-----5 # # y # ...
StarcoderdataPython
4841023
""" Tests for the :mod:`regression_tests.tools.r2plugin` module. """ from unittest import mock from regression_tests.filesystem.directory import Directory from regression_tests.filesystem.file import File from regression_tests.tools.r2plugin import R2Plugin from regression_tests.tools.r2plugin_arguments import R2...
StarcoderdataPython
4824761
<reponame>jinnerbichler/FARM import json import logging import os import numpy as np from scipy.special import expit import torch from transformers.modeling_bert import BertForPreTraining, BertLayerNorm, ACT2FN from torch import nn from torch.nn import CrossEntropyLoss, MSELoss, BCEWithLogitsLoss from farm.data_hand...
StarcoderdataPython
138330
<gh_stars>100-1000 """ pykube.http unittests """ import copy import logging import tempfile from pathlib import Path from . import TestCase BASE_CONFIG = { "clusters": [ {"name": "test-cluster", "cluster": {"server": "http://localhost:8080"}} ], "contexts": [ { "name": "test-cl...
StarcoderdataPython
189402
from experiments.localization.aachen import AachenLocalizer class LocalizersFactory(object): def __init__(self, cfg): self.cfg = cfg def get_localizer(self): localizer = None loc_name = self.cfg.task.task_params.dataset if loc_name == 'aachen_v11': localizer = Aach...
StarcoderdataPython
3331518
#! /usr/bin/env python # -*- coding: utf-8 -*- import cv2 import numpy as np import os print 'hi' def sieve_of_eratoshjen(N): arr = np.array([1 for i in xrange(0,N+1)]) arr[0] = 0 arr[1] = 0 for i in xrange(2,len(arr)): print i for j in xrange(i+1,len(arr)): if (j%i==0): ...
StarcoderdataPython
3228510
<reponame>SweetTomato111/flood-warning-system def stations_level_over_threshold(stations, tol): ''' Takes a list of station objects and a tolerance level. Returns a list of station objects with relative water level above tolerance. ''' output_list = [(station, station.relative_water_level()) for station in station...
StarcoderdataPython
1787187
from setuptools import setup with open("README.md", "r") as fh: long_description = fh.read() setup( name="slack-messages", version="0.0.2", description="Slack messages made easy. Send slack messages to channels from you backend api etc.", packages=["slack_messages"], py_modules=["slack_messa...
StarcoderdataPython
23845
<reponame>muellren/graalpython<filename>graalpython/benchmarks/src/meso/euler31.py #!/usr/bin/env python # Copyright 2008-2010 <NAME> # Copyright (c) 2013, 2014, Regents of the University of California # Copyright (c) 2017, 2018, Oracle and/or its affiliates. # All rights reserved. # # Revised BSD license # # This is a...
StarcoderdataPython
104078
<reponame>ryokbys/nap __version__ = "170130" __authors__ = "<NAME>" __email__ = "<EMAIL>" class Machine(): """ Parent class of any other machine classes. """ QUEUES = { 'batch': {'num_nodes': 12, 'default_sec': 86400, 'limit_sec': 604800}, 'default':{'num_nodes': 12, 'default_sec': ...
StarcoderdataPython
1770853
<filename>src/utils/validate_library.py #!/usr/bin/env python2 import ndpp_data as ndpp import numpy as np from xml.dom import minidom import sys mu_bins = 21 # Read command line arguments if len(sys.argv) < 2: sys.exit("Usage: validate_library.py <dir of ndpp_lib.xml>") working_dir = sys.argv[1] + '/' ndpp_lib_...
StarcoderdataPython
55098
<filename>rail/core/types.py """ Data types for RAIL File Input/Output """ #from rail.core.data import DataFile #class TextFile(DataFile): # """ # A data file in plain text format. # """ # suffix = "txt" # format = "http://edamontology.org/format_2330" #@classmethod #def read(cls, path): ...
StarcoderdataPython
120708
#!/usr/bin/python ################################################################################ # ____ __ __ _ _____ _ _ # # / __ \ \ \ / / | | / ____| | | | # # | | | |_ __ ___ _ __ \ /\ / /__| |__ | | __| | _...
StarcoderdataPython
1710324
import random from vidpy import Text, Clip, Composition lines = '''A spectre is haunting Europe - the spectre of communism. All the powers of old Europe have entered into a holy alliance to exorcise this spectre: Pope and Tsar, Metternich and Guizot, French Radicals and German police-spies. Where is the party in oppos...
StarcoderdataPython