id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
3385713
from squabblegui.sqsettingswidget import SqSettingsWidget from squabblegui.sqchatwidget import SqChatWidget
StarcoderdataPython
123552
import json import time import copy import checkpoint as loader import argparse import seaborn as sns import numpy as np import matplotlib.pyplot as plt from torch.autograd import Variable from torch import nn,optim import torch import torchvision import torch.nn.functional as F from torch import nn from PIL impor...
StarcoderdataPython
101238
# ------------------------------------------------------------------------------------------------- # STRING # ------------------------------------------------------------------------------------------------- print('\n\t\tSTRING\n') print("Hello Word!") # first example print('Hello Word!')...
StarcoderdataPython
8091864
<filename>experimental/tau_value_determination.py """ Script for determining the optimal tau value for the Singular Value Decomposition (SVD) unfolding. From http://root.cern.ch/root/html/TUnfold.html: Note1: ALWAYS choose a higher number of bins on the reconstructed side as compared to the generated size! No...
StarcoderdataPython
1772800
<filename>netforce_mfg/netforce_mfg/models/production_qc.py # 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 witho...
StarcoderdataPython
8180161
<filename>ros/src/perception/src/perception/video_inference.py import sys from moviepy.editor import * import perception.predict as predict import numpy as np import cv2 def main(): if len(sys.argv) != 2: print("Please specify path to movie file.") exit() filepath = sys.argv[1] print("Read...
StarcoderdataPython
3425201
<reponame>vijaykumawat256/Prompt-Summarization def solution(roman):
StarcoderdataPython
1712867
from __future__ import division import threading import time from src.robot import Robot from src.drawing import Map, Canvas import brickpi #Initialize the interface interface=brickpi.Interface() interface.initialize() Canvas = Canvas() Map = Map(Canvas) Robot = Robot(interface, pid_config_file="speed...
StarcoderdataPython
168189
<gh_stars>0 import setuptools with open("../readme.md", "r") as f: long_description = f.read() setuptools.setup( name="a9a", version="0.0.2", author="<NAME>", description="a9a archivator", long_description=long_description, long_description_content_type="text/markdown", packages=setupt...
StarcoderdataPython
99350
<filename>tests/elements/test_sextupole.py from unittest import TestCase import numpy as np from pyaccelerator.elements.sextupole import SextupoleThin class TestSextupoleThin(TestCase): def test_init(self): sextupole = SextupoleThin(1) assert sextupole.length == 0 assert sextupole.name.s...
StarcoderdataPython
298639
#Edited 12/3/17 <NAME> #Functions used to set up the algorithm and perform checks on the given #variables import scipy import numpy import sys import random import QJMCAA import QJMCMath #TESTED def dimensionTest(H,jumpOps,eOps,psi0): #Compare all to the hamiltonian dim = H.get_shape() c = 0 for item in jumpOps:...
StarcoderdataPython
1883962
from pandas import DataFrame from engine.pkmn.types.TypesBaseRuleSet import TypesBaseRuleSet from models.pkmn.types.PokemonType import PokemonType class ClassicTypesRuleSet(TypesBaseRuleSet): def __init__(self): # Init all at 1 type_effectiveness_chart = DataFrame({ref_pkmn_type: {pkmn_type: floa...
StarcoderdataPython
9779959
<gh_stars>0 import json def handler(context, event): # for object bodies, just take it as is. otherwise decode if not isinstance(event.body, dict): body = event.body.decode('utf8') else: body = event.body return json.dumps({ 'id': event.id, 'triggerClass': event.trigge...
StarcoderdataPython
3305951
<filename>sherry/inherit/__init__.py # encoding=utf-8 """ create by pymu on 2021/5/30 at 21:37 """
StarcoderdataPython
1842147
""" Overview ======== This module implements the INSERT mode that implements the functionality of inserting chars in the AreaVi instances. Key-Commands ============ Namespace: insert-mode Mode: NORMAL Event: <Key-i> Description: Get the focused AreaVi instance in INSERT mode. """ def insert(area): area.chmode(...
StarcoderdataPython
11245260
from .markdownify import markdownify
StarcoderdataPython
3448895
<gh_stars>1-10 # -*- coding: utf-8 -*- def main(): from itertools import combinations n, m = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] ans = 0 for t1, t2 in list(combinations(range(m), 2)): summed = 0 for i in range(n): ...
StarcoderdataPython
8058579
<reponame>EvictionLab/eviction-lab-etl<gh_stars>1-10 import sys import pandas as pd from data_constants import COLUMN_ORDER if __name__ == '__main__': df = pd.read_csv( sys.stdin, dtype={ 'GEOID': 'object', 'name': 'object', 'parent-location': 'object' })...
StarcoderdataPython
3313936
<reponame>dmft-wien2k/dmft-wien2k-v2<filename>script/gsl.py #! /usr/bin/env python # -*- coding: utf-8 -*- ### # # @file gsl.py # # DMFT is a software package provided by Rutgers Univiversity, # the State University of New Jersey # # @version 1.0.0 # @author <NAME> and <NAME> # @date 2016-02-15 # ### from utils impo...
StarcoderdataPython
5003398
<gh_stars>1-10 { 'targets': [ { # Needed declarations for the target 'target_name': 'bluetooth', 'conditions': [ [ 'OS=="freebsd" or OS=="openbsd" or OS=="solaris" or (OS=="linux")', { 'sources': [ "bluetooth.cc" ], 'libraries': ['-lopenobex', '-lobexftp', '-l...
StarcoderdataPython
5175383
from . import _loader def init(): _loader.init()
StarcoderdataPython
182369
<filename>tests/simsample.py import numpy as np from baggingrnet.data.simulatedata import simData from sklearn.model_selection import train_test_split nsample=12000 simdata=simData(nsample) simdata['gindex']=np.array([i for i in range(nsample)]) trainIndex, testIndex = train_test_split(range(nsample),test_size=0.2) ...
StarcoderdataPython
4944103
import os from functools import wraps import subprocess from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash, jsonify, Response from deploy import commands app = Flask('deploy.default_settings') app.config.from_object(__name__) app.config.from_envvar('DEPLOY_SETTINGS'...
StarcoderdataPython
1654450
<reponame>FreddyWordingham/arctk import numpy as np from math import pi as PI import math from scipy.special import gammainc from matplotlib import pyplot as plt import csv def sample(center,radius,n_per_sphere): r = radius ndim = center.size x = np.random.normal(size=(n_per_sphere, ndim)) #print("x", x...
StarcoderdataPython
3375078
<gh_stars>1-10 """Testing that the files can be accessed and are non-empty.""" import target_finder_model as tfm def test_constants(): """Test constants packaged with tfm""" assert tfm.CROP_SIZE[0] == tfm.CROP_SIZE[1] assert tfm.CROP_OVERLAP < tfm.CROP_SIZE[0] assert tfm.DET_SIZE[0] == tfm.DET_SIZE[...
StarcoderdataPython
1981357
<reponame>freepvps/hsesamples s = 'abc' s2 = f'{print(s)}' print(s2) def f(): print('a') print(f())
StarcoderdataPython
6669318
# Copyright 2016-2020 Blue Marble Analytics LLC. All rights reserved. """ **Relevant tables:** +--------------------------------+------------------------------------------------+ |:code:`scenarios` table column |:code:`project_specified_capacity_scenario_id` | +--------------------------------+--------------------...
StarcoderdataPython
3255034
<gh_stars>1-10 # Copyright © 2012-2018 <NAME> <<EMAIL>> # # 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, ...
StarcoderdataPython
6644131
<reponame>wwselleck/OpenFuji from __future__ import unicode_literals, absolute_import import six from jaraco.collections import KeyTransformingDict from . import strings class IRCDict(KeyTransformingDict): """ A dictionary of names whose keys are case-insensitive according to the IRC RFC rules. >>> ...
StarcoderdataPython
1805130
<filename>gnome/correlation/script.py<gh_stars>0 import pickle import openpyxl def fetch_file(path): with open(path, 'rb') as fp: file = pickle.load(fp) return file RELATIVE_PATH = "/home/imlegend19/PycharmProjects/Research - Data Mining/gnome/" wb = openpyxl.Workbook() sheet = wb.active titles ...
StarcoderdataPython
5036115
""" :type prices: List[int] :rtype: int """ class Solution: def maxProfit(self, prices): max = 0 min = 100000 for i in range(len(prices)): if prices[i] < min: min = prices[i] if prices[i] - min > max: max = prices[i] - min ...
StarcoderdataPython
6608698
from setuptools import setup, find_packages setup( name='controllerlibs', version='0.1.0', description='shared libraries of controller', url='', author='<NAME>', author_email='<EMAIL>', license='', keywords='', packages=find_packages(), install_requires=[ "Flask>=1.0", ...
StarcoderdataPython
9782839
<gh_stars>1000+ import logging log = logging.getLogger(__name__) __version__ = '0.9.0' try: from plex.client import Plex except Exception as ex: log.warn('Unable to import submodules - %s', ex, exc_info=True)
StarcoderdataPython
9656594
# Generated by Django 3.0.6 on 2020-07-09 11:02 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("discount", "0019_auto_20200217_0350"), ] operations = [ migrations.AlterModelOptions( name="vouchercustomer", options={"orde...
StarcoderdataPython
9626733
import simplejson import cgi class JSONFilter(object): def __init__(self, app, mime_type='text/x-json'): self.app = app self.mime_type = mime_type def __call__(self, environ, start_response): # Read JSON POST input to jsonfilter.json if matching mime type response = {'status': ...
StarcoderdataPython
5044883
# coding: utf-8 from __future__ import annotations from datetime import date, datetime # noqa: F401 import re # noqa: F401 from typing import Any, Dict, List, Optional # noqa: F401 from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401 from acapy_wrapper.models.ld_proof_vc_detail import LDProof...
StarcoderdataPython
8149030
<gh_stars>0 #Create Layout for impedance parameters from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.uix.textinput import TextInput from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.uix.modalview import ModalView from kivy.uix.spinner import Spinner fr...
StarcoderdataPython
11237459
<reponame>ICRC-BME/epycom # -*- coding: utf-8 -*- # Copyright (c) St. Anne's University Hospital in Brno. International Clinical # Research Center, Biomedical Engineering. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # Std imports # Third pary imports import pandas as...
StarcoderdataPython
3253339
# * -- utf-8 -- * # python3 # Author: Tang Time:2018/4/17 import math for i in range(100000): x = int(math.sqrt(i+100)) y = int(math.sqrt(i+268)) if (x*x == i+100) and (y*y ==i+268): print(i) '''简述:一个整数,它加上100和加上268后都是一个完全平方数 提问:请问该数是多少?'''
StarcoderdataPython
4917335
<reponame>dhruvilgandhi/DSA-Together-HacktoberFest #https://practice.geeksforgeeks.org/problems/find-pair-given-difference1559/1# # Approach : # Using Two Pointer techq # Sort the array before applying two pointer approach class Solution: def findPair(self, arr, L,N): arr.sort() i,j = 0...
StarcoderdataPython
194056
<filename>examples/legacy_examples/dagster_examples/gcp_data_platform/simple_pipeline.py import datetime import os from dagster_gcp.bigquery.resources import bigquery_resource from dagster_gcp.dataproc.resources import DataprocResource from google.cloud.bigquery.job import LoadJobConfig, QueryJobConfig from dagster i...
StarcoderdataPython
11218783
<gh_stars>1-10 import logging try: import json except ImportError: import simplejson as json from pylons import request, response, session, tmpl_context as c, url from pylons.controllers.util import abort, redirect from nipapwww.lib.base import BaseController, render from pynipap import Tag, VRF, Prefix, Pool...
StarcoderdataPython
6480158
# hello world code for driving robot from modules.default_config import motion motion.can.iface = 'can0' @_core.init_task def _(): _e.r.conf_set('send_status_interval', 10) _e.r.accel(400)
StarcoderdataPython
8069630
<filename>ghostdr/ghost/recipes/test/149_masterArc_test.py #!python import os import glob import shutil import re import numpy as np import pytest import itertools import astrodata from gempy.utils import logutils from recipe_system.reduction.coreReduce import Reduce from recipe_system.utils.reduce_utils import norma...
StarcoderdataPython
68886
<gh_stars>0 from django.test import TestCase from django.test.client import Client from google_analytics.utils import COOKIE_NAME from urlparse import parse_qs class GoogleAnalyticsTestCase(TestCase): def SetUp(self): pass def test_cookies_set_properly(self): client = Client() respons...
StarcoderdataPython
105416
def reverse(x): """ :type x: int :rtype: int """ if x < 0: x = str(x)[:0:-1] x = int("-" + x) else: x = str(x)[::-1] x = int(x) if x > 2**31 - 1 or x < -2**31: return 0 return x if __name__ == '__main__': x = 1534236469 y = reverse(x) pri...
StarcoderdataPython
1942957
## Quantile regression # # This example page shows how to use ``statsmodels``' ``QuantReg`` class to replicate parts of the analysis published in # # * <NAME> and <NAME>. "Quantile Regressioin". Journal of Economic Perspectives, Volume 15, Number 4, Fall 2001, Pages 143–156 # # We are interested in the relationsh...
StarcoderdataPython
5029790
<reponame>kristiewirth/dst<gh_stars>0 import os from collections import Counter import matplotlib.pyplot as plt import numpy as np import pandas as pd import progressbar import seaborn as sns class Eda: """ Exploratory data analysis (EDA) """ def separate_cols_by_type(self, df): """ ...
StarcoderdataPython
1992986
<gh_stars>0 def compute_fine(actual_date, expected_date): fine = 0 if actual_date[2] <= expected_date[2] and actual_date[1] <= expected_date[1] and actual_date[0] <= expected_date[0]: # Actual date is on or before expected date fine = 0 elif actual_date[0] > expected_date[0] and actual_date[1] == expected_date[...
StarcoderdataPython
11371570
<filename>fastaProcessing/fastaAlnCut.py<gh_stars>0 #!/usr/bin/env python ''' 1. fasta file (assume already aligned) 2. start (1-based) 3. end ''' from sys import argv, exit from Bio import SeqIO from os import system try: fname = argv[1] start = int(argv[2]) end = int(argv[3]) except: exit(__doc__)...
StarcoderdataPython
5092783
# Character field ID when accessed: 103000003 # ObjectID: 0 # ParentID: 103000003
StarcoderdataPython
168918
from cStringIO import StringIO from ceph_deploy.hosts import remotes class TestObjectGrep(object): def setup(self): self.file_object = StringIO('foo\n') self.file_object.seek(0) def test_finds_term(self): assert remotes.object_grep('foo', self.file_object) def test_does_not_fin...
StarcoderdataPython
48355
import datetime from django.test import TestCase from ..utils import get_fiscal_year, Holiday import logging logger = logging.getLogger(__name__) __author__ = 'lberrocal' class TestUtils(TestCase): def test_get_fiscal_year(self): cdates = [[datetime.date(2015, 10, 1), 'AF16'], [datetime....
StarcoderdataPython
3460556
<reponame>teodorpatras/crate-bench import os from crate import client from bench import importers, downloader FIXTURES_URL = "https://www.vbb.de/media/download/2029" IMPORT_MAPPING = { 'agency.txt': importers.AgenciesImporter, 'calendar_dates.txt': importers.CalendarDatesImporter, 'calendar.txt': importers...
StarcoderdataPython
3286742
<filename>mqttassistant/app.py import asyncio import signal from . import mqtt from . import web from .config import Config from .dispatch import Signal from .log import get_logger from .warn import configure_warnings configure_warnings() class Application: def __init__(self, **kwargs): self.logger = ge...
StarcoderdataPython
1912628
<reponame>davewood/do-portal import os from flask import request, current_app, g from app import db from app.core import ApiResponse, ApiPagedResponse from app.models import Sample, Permission from app.api.decorators import permission_required from app.tasks import analysis from app.utils import get_hashes from . impor...
StarcoderdataPython
8011746
<reponame>neerbek/taboo-selective # -*- coding: utf-8 -*- """ Created on October 3, 2017 @author: neerbek Trains a RNN flat model on input list of trees and embeddings """ import sys from numpy.random import RandomState # type: ignore import numpy as np import ai_util import jan_ai_util import rnn_model.rnn import...
StarcoderdataPython
4924613
<reponame>zuru/MappedConvolutions import torch import torch.nn as nn import math import _mapped_convolution_ext._weighted_mapped_avg_pooling as weighted_mapped_avg_pool import _mapped_convolution_ext._mapped_avg_pooling as mapped_avg_pool import _mapped_convolution_ext._resample as resample from .layer_utils import *...
StarcoderdataPython
9771030
from django.shortcuts import render from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from django.views.generic import View from django.contrib.auth import login, logout from django.contrib.auth.hashers import check_password from apps.goods.models import GoodsType from apps.user...
StarcoderdataPython
3205005
"""Tic Tac Toe.""" from game import Game import sys class TicTacToe(Game): """Tic Tac Toe game class.""" def __init__(self): """Construct new tictactoe game instance.""" self.board = ['-', '-', '-', '-', '-', '-', '-', '-', '-'] self.player = 'X' self.winner = None def ...
StarcoderdataPython
11283611
<filename>download.py import argparse import asyncio import hashlib from urllib.parse import urlsplit import aiohttp chunk_size = 1_024 # Set to 1 KB chunks async def download_url(url, destination): print(f'Downloading {url}') file_hash = hashlib.sha256() with open(destination, 'wb') as file: a...
StarcoderdataPython
357429
<reponame>vitekcode/premise from pathlib import Path import numpy as np import pandas as pd import wurst import yaml from schema import And, Optional, Or, Schema, Use from .ecoinvent_modification import ( LIST_IMAGE_REGIONS, LIST_REMIND_REGIONS, SUPPORTED_EI_VERSIONS, ) from .transformation import * from ...
StarcoderdataPython
3532458
<gh_stars>1-10 """ A circular racetrack has N runners on it, all running at distinct constant speeds in the same direction. There is only one spot along the track (say, the starting line) where any runner is allowed to pass any other runner; if two runners "collide" at any other point along the circle, then the race is...
StarcoderdataPython
3210119
from functions import * ##El conjunto a analizar es: #Conjunto = [2,4,6,9,12,18,27,36,48,60,72] #Prueba de que no cumple ningun orden #Conjunto = [0,1,2,3] #Relación =[(0,0),(0,1),(0,2),(0,3),(1,0),(1,1),(1,2),(1,3),(2,0),(2,2),(3,3)] #Prueba relacion de equivalencia #Conjunto =['a','b','c','d'] #Relación =[('a','a...
StarcoderdataPython
11204367
#!/usr/bin/env python # This example demonstrates the use of 2D text the old way by using a # vtkTextMapper and a vtkScaledTextActor. import vtk # Create a sphere source, mapper, and actor sphere = vtk.vtkSphereSource() sphereMapper = vtk.vtkPolyDataMapper() sphereMapper.SetInputConnection(sphere.GetOutputPort()) s...
StarcoderdataPython
6697978
<gh_stars>1-10 import os.path import gzip from itertools import izip folder = 'noEvolve3/' treatment_postfixes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 40, 60, 80, 100] slrs = [15] partners = ["Host", "Sym"] reps = range(10,21) #reps = range(1001, 1021) final_update = 3 header = "uid smoi slr rep update host_...
StarcoderdataPython
9614180
""" Clean the data """ from paths import * import os import emoji import string from datetime import datetime import re import nltk from pickle import dump from multiprocessing import Pool import random from my_random import SEED def clean_a_line(line, eng_words, remove_non_eng_words=False): """ Clean a singl...
StarcoderdataPython
9651317
# encoding: utf-8 """ Tests of the "software" module """ from datetime import date import json from fairgraph.software import Software, OperatingSystem, SoftwareCategory, ProgrammingLanguage, License from fairgraph.core import Person, Organization from fairgraph.commons import License try: import pyxus have_py...
StarcoderdataPython
95179
<filename>lenstronomywrapper/Sampler/launch_script.py from lenstronomywrapper.Sampler.run import run import sys import os from time import time #job_index = int(sys.argv[1]) job_index = 1 # the name of the folder containing paramdictionary files chain_ID = 'B1422' # where to generate output files #out_path = '/scrat...
StarcoderdataPython
394577
<gh_stars>10-100 #!/usr/bin/env python array = [ { 'fips': '01', 'abbr': 'AL', 'name': 'Alabama', }, { 'fips': '02', 'abbr': 'AK', 'name': 'Alaska', }, { 'fips': '04', 'abbr': 'AZ', 'name': 'Arizona', }, { 'fips': '05', 'abbr': 'AR', 'name': 'Arkansas', }, { 'fips': '06', 'abbr': '...
StarcoderdataPython
4854629
import os from torch.utils.data import Dataset from PIL import Image class SuperviselyPersonDataset(Dataset): def __init__(self, imgdir, segdir, transform=None): self.img_dir = imgdir self.img_files = sorted(os.listdir(imgdir)) self.seg_dir = segdir self.seg_files = sorted(os.listd...
StarcoderdataPython
8053988
import numpy as np import torch import torch.nn.functional as F import torch.nn as nn import sys from torch.autograd import Variable import math def flip(x, dim): xsize = x.size() dim = x.dim() + dim if dim < 0 else dim x = x.contiguous() x = x.view(-1, *xsize[dim:]) x = x.view(x.size(0), x.size(1...
StarcoderdataPython
3598801
<filename>util/tFunctions.py # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from collections import Counter from typing import List from azure.quantum.optimization import Term def tOrder ( terms0 : Term ) -> int : if len ( terms0.ids ) == 0 : return ( 0 ) return ( Counter ( ...
StarcoderdataPython
3406536
<reponame>egor5q/zombiedef # -*- coding: utf-8 -*- import os import telebot import time import telebot import random import info import threading from emoji import emojize from telebot import types from pymongo import MongoClient token = os.environ['TELEGRAM_TOKEN'] bot = telebot.TeleBot(token) client=MongoClient(o...
StarcoderdataPython
1774171
<gh_stars>1-10 from gym.envs.registration import register register( id='Drawenv-v0', entry_point='draw_gym.draw_env:DrawEnv', max_episode_steps=10, reward_threshold=0.0, )
StarcoderdataPython
3410060
<reponame>WitnessNR/Updated_WiNR from numba import njit import numpy as np import matplotlib.pyplot as plt from solve import * # from tensorflow.contrib.keras.api.keras.models import Sequential # from tensorflow.contrib.keras.api.keras.layers import Dense, Dropout, Activation, Flatten, GlobalAveragePooling2D, Lambda ...
StarcoderdataPython
3380640
<reponame>ViviHong200709/EduCDM # coding: utf-8 # 2021/6/19 @ tongshiwei from EduCDM.IRR import MIRT import logging from longling.lib.structure import AttrDict from longling import set_logging_info from EduCDM.IRR import pair_etl as etl, point_etl as vt_etl, extract_item set_logging_info() params = AttrDict( ba...
StarcoderdataPython
11332860
# # Copyright (c) 2017 Orange. # # 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 agre...
StarcoderdataPython
11381287
<filename>pdb_profiling/viewer.py # @Created Date: 2020-10-21 09:09:05 pm # @Filename: viewer.py # @Email: <EMAIL> # @Author: <NAME> # @Last Modified: 2020-10-21 09:09:10 pm # @Copyright (c) 2020 MinghuiGroup, Soochow University from pandas import isna, DataFrame from pdb_profiling.utils import expand_interval from pd...
StarcoderdataPython
1698160
<reponame>cmsong111/NJ_code a= int(input()) print('%X'% a)
StarcoderdataPython
3386126
<gh_stars>1-10 import tensorflow as tf from tensorflow.keras.applications import MobileNetV2 from tensorflow.keras.models import Model train_loss_tracker = tf.keras.metrics.Mean() val_loss_tracker = tf.keras.metrics.Mean() train_acc_tracker = tf.keras.metrics.SparseCategoricalAccuracy() val_acc_tracker = tf.keras.met...
StarcoderdataPython
11391149
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/00b_inference.export.ipynb (unless otherwise specified). __all__ = ['get_information'] # Cell from fastai.vision.all import * # Cell def _gen_dict(tfm): "Grabs the `attrdict` and transform name from `tfm`" tfm_dict = attrdict(tfm, *tfm.store_attrs.split(',')) ...
StarcoderdataPython
9635805
<gh_stars>1-10 import numpy as np def init_pop(n_pop, n_var, xl, xu): """ Initialize a population with uniform distribution parameter ---------- n_pop: int population size n_var: int number of decision variables xl, xu: float lower and upper boundary of decision variables...
StarcoderdataPython
3318163
<gh_stars>1-10 def output_gpx(points, output_filename): """ Output a GPX file with latitude and longitude from the points DataFrame. """ from xml.dom.minidom import getDOMImplementation def append_trkpt(pt, trkseg, doc): trkpt = doc.createElement('trkpt') trkpt.setAttribute('lat', '%...
StarcoderdataPython
8088916
<reponame>alviproject/alvi def create_node(pipe, id, parent_id, value): pipe.send('create_node', (id, ), dict( id=id, parent_id=parent_id, value=value, )) def update_node(pipe, id, value): pipe.send('update_node', (id, ), dict( id=id, value=value, )) def remov...
StarcoderdataPython
11382161
<gh_stars>10-100 import unittest import ctypes as ct from ctree.c.nodes import * class TestSymbols(unittest.TestCase): def _check(self, actual, expected): self.assertEqual(actual.codegen(), expected) def test_symbolref(self): ref = SymbolRef("foo") self._check(ref, "foo") def te...
StarcoderdataPython
8192514
# 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 GetInst...
StarcoderdataPython
164152
<gh_stars>0 import machine, network, ubinascii, ujson, urequests WiFi = network.WLAN(network.STA_IF) mac = ubinascii.hexlify(network.WLAN().config("mac"),":").decode() print("MAC address: " + mac) def connect(): import network, utime WiFi = network.WLAN(network.STA_IF) if not WiFi.isconnected():...
StarcoderdataPython
244390
# -*- coding: utf-8 -*- import re # All of the variables available in a PKGBUILD PB_VARIABLES = [ # String variables 'pkgver', 'pkgrel', 'pkgdesc', 'url', 'epoch', 'pkgbase', # Bash Array variables 'pkgname', 'license', 'source', 'groups', 'arch', 'depends', 'makedepends', 'checkdepends', 'optdepe...
StarcoderdataPython
9719582
<reponame>marstr/azure-cli-dev-tools # ----------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------...
StarcoderdataPython
4974001
import hashlib import json from time import time from uuid import uuid4 from urllib.parse import urlparse import requests class Blockchain(object): def __init__(self): # Initiates the blockchain self.chain = [] self.current_transactions = [] # Creating a genesis block se...
StarcoderdataPython
6658877
""" Comparing optimizers ===================== Comparison of optimizers on various problems. """ import functools import pickle import numpy as np from scipy import optimize from joblib import Memory from cost_functions import mk_quad, mk_gauss, rosenbrock,\ rosenbrock_prime, rosenbrock_hessian, LoggingFunction,...
StarcoderdataPython
11278559
<reponame>raufer/pytheater from pytheater.actor import Actor class AnonymousActor(Actor): async def receive(self, message, sender=None): return message
StarcoderdataPython
3231783
''' Created on Nov 12, 2016 @author: jeanl ''' import FlightDB as fDB from Midterm_Graph import * DBAddress = './Database/Graph.db' AirAddress = './Database/AirportData.csv' FlyAddress = './Database/FlightData.csv' folder_name = './Database' # Make a Database database = fDB.FlightDB(folder_name) GraphAddress = 'C:\...
StarcoderdataPython
9692336
<gh_stars>1000+ import collections import os import six import yaml from copy import deepcopy from geodata.address_formatting.formatter import AddressFormatter from geodata.configs.utils import recursive_merge, DoesNotExist from geodata.encoding import safe_encode this_dir = os.path.realpath(os.path.dirname(__file_...
StarcoderdataPython
9778361
import __main__ from threading import Thread import dbus from dbus.mainloop.glib import DBusGMainLoop from gi.repository import GLib from gi.repository import GObject try: DBusGMainLoop(set_as_default=True) GObject.threads_init() dbus.mainloop.glib.threads_init() dbus_loop = DBusGMainLoop() DBUS_BU...
StarcoderdataPython
286051
#Shipping Accounts App #Define list of users users = ['eramom', 'footea', 'davisv', 'papinukt', 'allenj', 'eliasro'] print("Welcome to the Shipping Accounts Program.") #Get user input username = input("\nHello, what is your username: ").lower().strip() #User is in list.... if username in users: #print a price ...
StarcoderdataPython
8171230
<filename>all.py # all.py made for the DSS project. # Written by A.E.A.E, To be committed on Github # Imports from sklearn.datasets import load_digits from sklearn.linear_model import LogisticRegression from sklearn.neighbors import KNeighborsClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.m...
StarcoderdataPython
5044605
nombre = 'Soto' lugar = 'San Telmo' hora = '3 de la mañana' comida = 'mondiola' # los %s sereemplazan con las cadenas del final, en el orden en que aparecen. print('Hola, %s, te invito a una fiesta en %s, mañana a las %s. Traé %s.' % (nombre, lugar, hora, comida))
StarcoderdataPython
5073587
<filename>team7/notmain.py<gh_stars>1-10 import webbrowser webbrowser.open("https://www.youtube.com/watch?v=z8ZqFlw6hYg") while True: print("ValueError: ctypes objects containing pointers cannot be pickled")
StarcoderdataPython