id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
12818018
# Main Code Contributions: # SPDX-FileCopyrightText: 2021 Team 4160 "The Robucs" Mission Bay HighSchool # SPDX-License-Identifier: MIT # Some Code greatfully reused from: # SPDX-FileCopyrightText: 2019 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT #==================================== import time imp...
StarcoderdataPython
3541410
<filename>pddlstream/language/write_pddl.py import re import math from pddlstream.language.constants import AND, OR, OBJECT, TOTAL_COST, TOTAL_TIME, is_cost, get_prefix, \ CONNECTIVES, QUANTIFIERS from pddlstream.language.conversion import pddl_from_object, is_atom, is_negated_atom, objects_from_evaluations from p...
StarcoderdataPython
204042
<filename>fechbase.py<gh_stars>1-10 class RecordsBase: pass class VersionBase: pass class VersionsBase: pass
StarcoderdataPython
1860179
<reponame>librazh/financial-analysis<filename>app/index_forecast.py # -*- coding: utf-8 -*- """ TODO: Track and forecast indexes """ import matplotlib.pyplot as plt from .my_logging import get_logger from .my_tushare import get_tushare logger = get_logger() ts = get_tushare() def demo(index_code): ...
StarcoderdataPython
1623954
# !/usr/bin/env python # encoding:UTF-8 from django.shortcuts import render # from dynamic_preferences.models import global_preferences # from dynamic_preferences.registries import autodiscover # autodiscover(True) def home(request): # gp = global_preferences.to_dict() return render(request, 'home.html', { ...
StarcoderdataPython
3546553
''' Python question by HackerRank TODO 1: "Exceptions" You have to pass all the testcases to get a positive score. ''' import re # TODO 1: "Exceptions" def exceptions_example(): number_of_tests = int(input().lstrip().rstrip()) for _ in range(int(number_of_tests)): try: a, b = [int(i) for ...
StarcoderdataPython
1865402
# Generated by Django 3.0 on 2021-03-08 14:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('alldata', '0026_quizquestion_friend'), ] operations = [ migrations.RemoveField( model_name='priority', name='id', ...
StarcoderdataPython
6656602
import mbuild import numpy as np def get_height(r, theta): """ Helper function to get the height of a spherical cap """ return r - r * np.cos(theta * np.pi / 180) class Droplet(mbuild.Compound): """ Builds a droplet on a lattice. Parameters ---------- radius : int, default = 2 ...
StarcoderdataPython
1967555
# encoding: utf8 from __future__ import unicode_literals STOP_WORDS = set( """ alle allerede alt and andre annen annet at av bak bare bedre beste blant ble bli blir blitt bris by både da dag de del dem den denne der dermed det dette disse drept du eller en enn er et ett etter fem fikk fire fjor flere folk for...
StarcoderdataPython
6589013
#!/usr/bin/python # -*- coding: utf-8 -*- # Software License Agreement (BSD License) # # Copyright (c) 2009-2011, Eucalyptus Systems, Inc. # All rights reserved. # # Redistribution and use of this software in source and binary forms, with or # without modification, are permitted provided that the following conditions #...
StarcoderdataPython
1925561
{'type': 'string'} {'type': 'string'} {'type': 'string'} {'type': 'string'} {'type': 'number', 'format': 'int'} {'type': 'string', 'description': 'The id used by the provider'} {'type': 'string', 'format': 'url'} {'type': 'string', 'format': 'url'} ['http://purl.org/dc/elements/1.1/', 'publisher', 'dc'] {'type': 'strin...
StarcoderdataPython
306685
<filename>setup.py # pylint: disable=missing-docstring # Copyright (c) 2016 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
StarcoderdataPython
9608223
<filename>gslab_scons/tests/test_release_tools.py import unittest import sys import os import mock # Import module containing gslab_scons testing side effects import gslab_scons.tests._side_effects as fx # Ensure that Python can find and load the GSLab libraries os.chdir(os.path.dirname(os.path.realpath(__file__))) sy...
StarcoderdataPython
11209617
<reponame>roedesh/nxstart # -*- coding: utf-8 -*- """Includes tests for the 'libnx' command""" import os from click.testing import CliRunner from nxstart.cli import cli from nxstart.tests.helpers import (APP_AUTHOR, APP_NAME, DATE_CREATED, DIRECTORY_NAME, directory_exists, ...
StarcoderdataPython
11273794
<filename>h5sh/scripts/__init__.py<gh_stars>1-10 # -*- coding: utf-8 -*- """Command line entry points."""
StarcoderdataPython
3580217
<gh_stars>1-10 #------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the cond...
StarcoderdataPython
3220054
""" Contains modules related to cleaning and features processing Modules : - Categorical_Data - Date_Data - Label encoder - Missing_Values - Process_Outliers - Scaling """ __all__ = ['Categorical', 'Date', 'Deep_Encoder', 'Missing_Values', 'Outliers']
StarcoderdataPython
4934725
<filename>GamePlaying/my_custom_player.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 8 13:56:52 2020 @author: alysonweidmann """ import random from GamePlaying.sample_players import DataPlayer _WIDTH = 11 _HEIGHT = 9 _SIZE = (_WIDTH + 2) * _HEIGHT - 2 class CustomPlayer(DataPlayer): ...
StarcoderdataPython
11346074
print("%s" % 1.0) print("%r" % 1.0) print("%d" % 1.0) print("%i" % 1.0) print("%u" % 1.0) # these 3 have different behaviour in Python 3.x versions # uPy raises a TypeError, following Python 3.5 (earlier versions don't) #print("%x" % 18.0) #print("%o" % 18.0) #print("%X" % 18.0) print("%e" % 1.23456) print("%E" % 1....
StarcoderdataPython
1867894
import abc import cv2 as cv import matplotlib.pyplot as plt import scipy from skimage.measure import regionprops from tfcore.utilities.image import * from PIL import Image class Preprocessing(): def __init__(self): self.functions = ([], [], []) def add_function_x(self, user_function): self....
StarcoderdataPython
4807326
""" Holds the session class for user authentication and session specific data storage """ ################################################################################ ################################################################################ import os import time import datetime import traceback import logg...
StarcoderdataPython
3472386
<reponame>ASHISHKUMAR2411/Programming-CookBook from threading import Lock from werkzeug.wsgi import pop_path_info, peek_path_info from myapplication import create_app, default_app, get_user_for_prefix class PathDispatcher(object): def __init__(self, default_app, create_app): self.default_app = default_ap...
StarcoderdataPython
6701290
""" Main app/routing file for Twitoff """ from os import getenv from flask import Flask, render_template, request from .models import DB, MIGRATE, User from twitoff.routes.home_routes import home_routes from twitoff.routes.prediction_routes import prediction_routes from twitoff.routes.data_routes import data_routes ...
StarcoderdataPython
11383287
<filename>winguhub/views/__init__.py<gh_stars>0 # encoding: utf-8 import os import stat import simplejson as json import re import sys import urllib import urllib2 import logging import chardet from types import FunctionType from datetime import datetime from math import ceil from urllib import quote from django.core.c...
StarcoderdataPython
11275814
<reponame>spiralgenetics/biograph """ Given an BioGraph discovery vcf, reduce the graph complexity by removing extra 'noise' in SNP/INDELS that have PDP==0 and aren't in phase with SVs. Inputs and outputs MUST be sorted. """ import sys import argparse from collections import defaultdict import pysam def parse_args(a...
StarcoderdataPython
1656099
# Create a variable called user_name that captures the user's first name. user_name = input("What is your name? ") # Create a variable called friend_name that captures the name of the user's friend. friend_name = input("What is your friend's name? ") # Create variables to capture the number of months the user has bee...
StarcoderdataPython
1949491
from tools.utils import create_coco_path_list create_coco_path_list('/home/zqh/Documents/tiny-yolo-tensorflow/data/images', '/home/zqh/Documents/tiny-yolo-tensorflow/data/labels')
StarcoderdataPython
11361389
#!/usr/bin/env python import numpy as np def zero_crossing(image): pass
StarcoderdataPython
1943455
<filename>bokego/mcts.py from collections import defaultdict from math import sqrt import numpy as np import torch import torch.multiprocessing as mp from torch.distributions import dirichlet, categorical import os from copy import copy, deepcopy import bokego.nnet as nnet from bokego.nnet import ValueNet, PolicyNet, ...
StarcoderdataPython
9618475
from datetime import datetime,timedelta class templog: def __init__(self): f_temps = open('beamformer_temp.log','r') datetimes_and_temps_raw = f_temps.readlines() f_temps.close() self.dt_start = self.todatetime(*(datetimes_and_temps_raw[0].split(',')[0].split())) self.dt_end = self.todatetime(*(datetime...
StarcoderdataPython
11263133
<reponame>JakeWasChosen/edoC """ The MIT License (MIT) Copyright (c) 2021 https://github.com/summer 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 limitati...
StarcoderdataPython
5032411
<gh_stars>1-10 import json import pytest from devtools_testutils import AzureRecordedTestCase, CachedResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async from azure.core.credentials import AzureKeyCredential, AzureSasCredential from azure.eventgrid.aio import EventGridPublisherClient from ...
StarcoderdataPython
224581
<filename>plugins/holland.backup.mysqldump/holland/backup/mysqldump/mysql/option.py """MySQL option files support http://dev.mysql.com/doc/refman/5.1/en/option-files.html """ import os import re import codecs import logging from holland.backup.mysqldump.util import INIConfig, BasicConfig from holland.backup.mysqldump....
StarcoderdataPython
6478296
<reponame>epanjwani/activity # Generated by Django 2.2.10 on 2020-08-17 15:24 import datetime from django.db import migrations, models import django.db.models.deletion import formlibrary.models.case class Migration(migrations.Migration): dependencies = [ ('formlibrary', '0009_merge_20200620_0127'), ...
StarcoderdataPython
3558979
<filename>lib/python3.8/site-packages/ansible_collections/community/network/plugins/modules/network/icx/icx_system.py #!/usr/bin/python # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_funct...
StarcoderdataPython
6501869
pkgname = "efivar" pkgver = "37" pkgrel = 0 build_style = "makefile" make_cmd = "gmake" make_build_target = "all" make_build_args = ["libdir=/usr/lib", "ERRORS="] make_install_args = ["libdir=/usr/lib"] make_check_target = "test" hostmakedepends = ["pkgconf", "gmake"] makedepends = ["linux-headers"] pkgdesc = "Tools an...
StarcoderdataPython
1747760
<reponame>PacktPublishing/Learn-Quantum-Computing-with-Python from pyquil import Program from pyquil.gates import * program = Program() program = program + X(0) print(program)
StarcoderdataPython
161541
import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cm from matplotlib.lines import Line2D def plotMeasurement(L, indices, measurements, s=0.25, filename=None, title=None, url=None): fig = plt.figure() axes = fig.add_subplot(111, pro...
StarcoderdataPython
8127751
<reponame>powerfulbean/StellarWave<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Thu Jan 27 17:57:19 2022 @author: <NAME> """ import os from abc import abstractmethod,ABC from .. import outsideLibInterfaces as outLib from ..DataIO import getFileName from .Cache import CStimuliCache from ..DataStruct.Abstract imp...
StarcoderdataPython
1745436
<filename>coffeestats/caffeine/authbackend.py """ Custom authentication backend for coffeestats. """ from passlib.hash import bcrypt import logging from django.utils import timezone from django.contrib.auth.hashers import make_password from .models import User logger = logging.getLogger(__name__) class LegacyCo...
StarcoderdataPython
1959890
<reponame>telefonicaid/fiware-cosmos-platform<filename>cosmos-cli/cosmos/compute/tests/test_protocol.py # -*- coding: utf-8 -*- # # Copyright (c) 2013-2014 Telefónica Investigación y Desarrollo S.A.U. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance wi...
StarcoderdataPython
8155783
#!/usr/bin/env python # # Copyright 2009 <NAME> (<EMAIL>) # Reviewed by <NAME>. # # This is a simple Tf-idf library. The algorithm is described in # http://en.wikipedia.org/wiki/Tf-idf # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # L...
StarcoderdataPython
5167295
from rpi_ws281x import PixelStrip, WS2811_STRIP_RGB # Matrix: WIDTH = 13 + 25 HEIGHT = 8 # LED configuration. LED_COUNT = WIDTH * HEIGHT # How many LEDs to light. LED_DMA_NUM = 10 # DMA channel to use, can be 0-14. LED_GPIO = 21 # GPIO connected to the LED signal line. Must support PWM! class LEDs(PixelStrip): ...
StarcoderdataPython
391491
<filename>Lib/site-packages/prompt_toolkit/output/conemu.py import sys assert sys.platform == "win32" from typing import Any, Optional, TextIO from prompt_toolkit.data_structures import Size from .base import Output from .color_depth import ColorDepth from .vt100 import Vt100_Output from .win32 import Win32Output ...
StarcoderdataPython
12801185
# demo of temperature-controlled neopixel ring # 2017-0813 PePo - extracted from tutorial <NAME>!, youtube # TMP36 instead of humidity # # Configuration: # TMP36 is direct connected to ADC-port of Huzzah # 8-neopixel stick is direct connected to pin 16 of Huzzah # neopixelstick is powered from USB-port (which is 5V?!)...
StarcoderdataPython
1856486
from typing import Any from fastapi import APIRouter from app.schemas.msg import Msg router = APIRouter() @router.get( "/hello-world", response_model=Msg, status_code=200, include_in_schema=False, ) def test_hello_world() -> Any: return {"msg": "Hello world!"}
StarcoderdataPython
6614555
<filename>Gui/opensim/Scripts/runTutorialTwo.py # --------------------------------------------------------------------------- # # OpenSim: runTutorialTwo.py # # --------------------------------------------------------------------------- # # OpenSim is a toolkit for muscu...
StarcoderdataPython
344784
from .tableentrysort import sort_table_entries from .common import assert_prettifier_works def test_table_sorting(): toml_text = """description = "" firstname = "adnan" lastname = "fatayerji" git_aydo = "" groups = ["sales", "dubai", "mgmt"] skype = "" emails = ["<EMAIL>", "<EMAIL>", "<EMAIL>", "<EMAIL>", "<...
StarcoderdataPython
12850319
<filename>tour5_damage_bond/damage2d_explorer.py import numpy as np import sympy as sp import bmcs_utils.api as bu from bmcs_cross_section.pullout import MATS1D5BondSlipD s_x, s_y = sp.symbols('s_x, s_y') kappa_ = sp.sqrt( s_x**2 + s_y**2 ) get_kappa = sp.lambdify( (s_x, s_y), kappa_, 'numpy' ) def get_tau_s(s_x_n1,...
StarcoderdataPython
1671103
<filename>model/network/MT3D.py import torch import torch.nn as nn import numpy as np from .basic_blocks import SetBlock, BasicConv2d, M3DPooling, FramePooling, FramePooling1, LocalTransform, BasicConv3DB, GMAP, SeparateFC class MTNet(nn.Module): def __init__(self, hidden_dim): super(MTNet, self).__init_...
StarcoderdataPython
1900527
<reponame>tommyjcarpenter/dev-bootstrap from setuptools import setup, find_packages setup( name="bootstrap", version="1.0.0", packages=find_packages(), author="<NAME>", author_email="<EMAIL>", description=("Dev env bootstrapping"), license="MIT", url="https://github.com/tommyjcarpenter/...
StarcoderdataPython
6653586
constants.physical_constants["kelvin-joule relationship"]
StarcoderdataPython
8014368
<filename>profiles_api/views.py from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status, viewsets, filters from rest_framework.authentication import TokenAuthentication from rest_framework.authtoken.views import ObtainAuthToken from rest_framework.settings...
StarcoderdataPython
3341206
import pandas as pd from pathlib import Path from bert_clf.src.pandas_dataset.BaseDataset import BaseDataset import os class PandasDataset(BaseDataset): """ Dataset class for datasets that have simple structure """ def __init__(self, train_data_path: str, test_data_pa...
StarcoderdataPython
4898579
<reponame>yarikoptic/duecredit # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the duecredit package for the # copyright...
StarcoderdataPython
6489861
<reponame>Xrenya/algorithms digit = input() def digit_sum(digit): return sum([(int(x)) for x in digit]) print(digit_sum(digit))
StarcoderdataPython
5060142
"""Add new table for PasswordReset model. Revision ID: 32839e658194 Revises: <PASSWORD> Create Date: 2017-11-13 08:12:28.990037 """ from __future__ import absolute_import, division, print_function, unicode_literals import sqlalchemy as sa from alembic import op # Revision identifiers, used by Alembic. revision = '...
StarcoderdataPython
5139881
<reponame>metabolize-forks/booby<gh_stars>0 # -*- coding: utf-8 -*- from expects import * from booby import fields, models IRRELEVANT_NAME = 'irrelevant name' IRRELEVANT_EMAIL = 'irrelevant email' ENCODED_IRRELEVANT_NAME = 'encoded irrelevant name' ENCODED_IRRELEVANT_EMAIL = 'encoded irrelevant email' IRRELEVANT_DA...
StarcoderdataPython
1826416
<reponame>rsdoherty/azure-sdk-for-python<filename>sdk/cognitiveservices/azure-cognitiveservices-search-websearch/azure/cognitiveservices/search/websearch/models/__init__.py # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reser...
StarcoderdataPython
11344022
# Exercise 3.17 # Author: <NAME> from scipy.integrate import quad from scipy import exp, pi, cos, log, sqrt def diff2(f, x, h=1E-6): r = (f(x - h) - 2 * f(x) + f(x + h)) / (h ** 2) return r def adaptive_trapezint(f, a, b, eps=1E-4): ddf = [] for i in range(101): ddf.append(abs(diff2(f, a + ...
StarcoderdataPython
9767394
import sys from random import randrange, uniform from collections import OrderedDict as od def visitNFA(table, input_, accepting_states): number_of_states = len(table) active_states = [1] + ([0] * number_of_states) for char in input_: temp = [0] * number_of_states next_states = [] ...
StarcoderdataPython
11228504
from flask_sqlalchemy_bundle import db class OneBasic(db.Model): class Meta: lazy_mapped = True name = db.Column(db.String) class OneParent(db.Model): class Meta: lazy_mapped = True # relationships = {'OneChild': 'children'} name = db.Column(db.String) children = db.re...
StarcoderdataPython
9679998
<filename>tests/test_snakefile.py import subprocess def test_snakefile_dryrun(): subprocess.run(['snakemake', '-n', '-r'], check=True) assert True def test_snakefile_full(setup_snakefile): # Set the config MIC csv to use our test one mic_csv = 'tests/public_mic_class_dataframe_test.csv' # Use Sn...
StarcoderdataPython
9671178
<filename>core/models.py from django.db import models from django.contrib.auth.models import AbstractBaseUser,BaseUserManager class UsuarioManager(BaseUserManager): use_in_migrations = True def _create_user(self, ra, password, **extra_fields): if not ra: r...
StarcoderdataPython
12837400
<filename>UnityPy/Logger.py<gh_stars>0 import logging import sys from termcolor import colored if sys.platform == 'win32': from colorama import init init() COLORS = { 'DEBUG': 'green', 'INFO': 'yellow', 'WARNING': 'magenta', 'ERROR': 'red', } class ListHandler(logging.Handler): def __init__(self): supe...
StarcoderdataPython
3561577
""" Generate a dataset with the following properties - Binary classification - Static features which are ~0.7 separable using RF - Dynamic features which are ~0.7 separable using generative-model-based classifier - Some of the instances must be predicatable only from the static features, other only fro...
StarcoderdataPython
3220962
from numpy import dot, sum, tile, exp, log, pi, shape, reshape from numpy.linalg import inv, pinv, LinAlgError, det import logging logger = logging.getLogger("KalmanFilter") # X: state vector at k-1 # P: covariance matrix at k-1 # A: state transition matrix # Q: process noise covariance matrix # B: input ...
StarcoderdataPython
190600
<reponame>Valentin-Aslanyan/ASOT file_directory="./" bfield_file="bfield.0057883" import sys sys.path[:0]=['/Change/This/Path'] from ASOT_Functions_Python import * time,ntblks,nlblks,coord_logR,coord_theta,coord_phi,B=read_bfield_file(file_directory,bfield_file)
StarcoderdataPython
8110189
<gh_stars>0 import threading from receiver import Receiver import socketserver import datetime import socket from flask import Flask, render_template from flask_socketio import SocketIO async_mode = None receiver_port = 9090 app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' socketio = SocketIO(app, async_mo...
StarcoderdataPython
6503974
# encoding: utf-8 """Provides Python 2 compatibility objects.""" from StringIO import StringIO as BytesIO # noqa def is_integer(obj): """Return True if *obj* is an integer (int, long), False otherwise.""" return isinstance(obj, (int, long)) def is_string(obj): """Return True if *obj* is a string, Fal...
StarcoderdataPython
3591085
import psycopg2 class Postgres(object): def __init__(self, server, port, database, username, password): dbconn = {'database': database, 'user': username, 'password': password, 'host': server, 'port': port} self.pg_conn = ps...
StarcoderdataPython
272073
from lona.html import Strong, Button, CLICK, HTML, Div, H1 from lona import LonaView, LonaApp from lona_chartjs import Chart app = LonaApp(__file__) app.add_static_file('lona/style.css', """ body{ font-family: sans-serif; } """) @app.route('/') class ChartjsClickAnalyzerView(LonaView): def hand...
StarcoderdataPython
9649031
# waht we need: policy and state transition matrix # combine those two into one ditcionary and read it out into a textfile import numpy as np import pandas as pd import matplotlib.pyplot as plt import time from collections import Counter from PlotCircles import circles import multiprocessing import itertools import os ...
StarcoderdataPython
3582712
<gh_stars>0 # somefile.py def say_hello(name): print(f"Hello", name) if __name__ == '__main__': say_hello('Brian')
StarcoderdataPython
5166945
# arctan = sum_n=0^inf (-1)^n x^(2n+1) / (2n + 1) # pi = 16 arctan(1/5) - 4 arctan(1/239) from fractions import Fraction with open("pi.txt") as f: pi = f.read() def compute_pi(n, m): pi = 0 for i in range(n): pi += 16 * (-1) ** i * Fraction(1, (2 * i + 1) * 5 ** (2 * i + 1)) for i in range(m)...
StarcoderdataPython
9782393
from pylab import *; import RungeKutta; def dummy(t, f, args): return zeros(f.shape); def dummyVel(f, args): return 1.3; u = zeros((10,10)); v = zeros((10,10)); z = zeros((10,10)); delta = 0.1; stepfwd = RungeKutta.RungeKutta4(delta, dummy, dummy, dummyVel); tnew, fnew = stepfwd.integrate(0, [u,v,z],0....
StarcoderdataPython
1941415
from django.db import models from django.utils import timezone # https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html#onetoone from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver # Slug from django.db...
StarcoderdataPython
8089208
from unittest import TestCase from trading_calendars.exchange_calendar_us_extended_hours import USExtendedHoursExchangeCalendar from .test_trading_calendar import ExchangeCalendarTestBase class USExtendedHoursCalendarTestCase(ExchangeCalendarTestBase, TestCase): answer_key_filename = "us_extended_hours" ca...
StarcoderdataPython
8130830
<reponame>WingsSec/Meppo #!/usr/bin/env python3 # _*_ coding:utf-8 _*_ from cgi import print_form import requests import re from Config.config_requests import ua requests.packages.urllib3.disable_warnings() # 脚本信息 ###################################################### NAME = 'CNVD_2020_26585' AUTHOR = "JDQ" REMARK =...
StarcoderdataPython
5025211
<gh_stars>0 # -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Invenio module that adds userprofiles to the platform.""" from __futu...
StarcoderdataPython
6682046
import warnings import rasterio def rasterio_decorator(func): def wrapped_f(*args, **kwargs): with warnings.catch_warnings(): warnings.simplefilter("ignore") with rasterio.drivers(): return func(*args, **kwargs) return wrapped_f
StarcoderdataPython
3266164
import torch import torch.distributed as dist def check_equal(A, B): assert torch.allclose(A, B, rtol=1e-3, atol=1e-1) == True def replace_parameter_add_grad(layer, weight=None, bias=None): if weight is not None: delattr(layer, 'weight') setattr(layer, 'weight', weight) layer.weight.re...
StarcoderdataPython
1922702
<reponame>livenson/waldur-freeipa from . import tasks, utils from .log import event_logger def schedule_sync(*args, **kwargs): tasks.schedule_sync() def schedule_sync_on_quota_change(sender, instance, created=False, **kwargs): if instance.name != utils.QUOTA_NAME: return if created and instance....
StarcoderdataPython
1656590
<reponame>rakesh-lagare/Thesis_Work # -*- coding: utf-8 -*- from random import randrange import matplotlib.pyplot as plt import numpy as np import numpy.random as nprnd import pandas as pd import os os.remove("dataframe.csv") os.remove("dataList.csv") def pattern_gen(clas,noise,scale,offset): ts_data=[] ...
StarcoderdataPython
3412713
<reponame>tiphaine/o2-base<gh_stars>0 import os caf_raw = os.path.join('data', 'raw', 'caf') caf_processed = os.path.join('data', 'processed', 'caf') foyers_alloc_bas_revenus_prefix = 'http://data.caf.fr/dataset/79250fae-53f6-4d7c-91da-218e79bdcb60/resource/' foyers_alloc_bas_revenus_url = { 'commune': { ...
StarcoderdataPython
3313658
# /bin/env python """ pyFSQP - A variation of the pyFSQP wrapper specificially designed to work with sparse optimization problems. """ # ============================================================================= # FSQP Library # ============================================================================= try: f...
StarcoderdataPython
11264632
<reponame>dwahme/simple_cpu class Assembler: def __init__(self): pass # Converts an instruction to binary def encode(self, opcode, num_args, starts, args): instr = opcode << 12 if num_args != len(args): strs = [str(x) for x in args] print("Invalid number o...
StarcoderdataPython
5167811
<filename>tests/pyccel/scripts/import_syntax/collisions4.py # pylint: disable=missing-function-docstring, missing-module-docstring/ import user_mod import user_mod2 test = user_mod.user_func(1.,2.,3.) + user_mod2.user_func(4.,5.) print(test)
StarcoderdataPython
1703686
<reponame>ayanezcasal/AntLibAYC<filename>libAnt/profiles/speed_cadence_profile.py from libAnt.core import lazyproperty from libAnt.profiles.profile import ProfileMessage class SpeedAndCadenceProfileMessage(ProfileMessage): """ Message from Speed & Cadence sensor """ def __init__(self, msg, previous): ...
StarcoderdataPython
6661737
# -*- coding: utf-8 -*- """ cherry.performance ~~~~~~~~~~~~ This module implements the cherry performance. :copyright: (c) 2018-2019 by <NAME> :license: MIT License, see LICENSE for more details. """ import numpy as np from sklearn.model_selection import KFold from sklearn.pipeline import Pipeline from sklearn import...
StarcoderdataPython
3582905
<reponame>cnzakimuena/avRNS<gh_stars>0 """ spec_gen constructs a labelled dataset of spectrogram images from spatial series obtained using MATLAB for use as input to machine learning classification algorithms. """ from os.path import join as p_join import scipy import scipy.io as sio from scipy import signal...
StarcoderdataPython
3452631
# scrapy crawl greenbook -s LOG_FILE=scrapy.log -o data.csv import scrapy class GreenbookSpider(scrapy.Spider): name = 'greenbook' start_urls = [ 'http://www.thegreenbook.com/products/search/architect-builder-contractor-guides/' ] def parse(self, response): for href in resp...
StarcoderdataPython
3357655
<filename>compiler/eLisp/eLisp/model.py #!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright (c) 2015 ASMlover. 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 s...
StarcoderdataPython
1819726
""" Module that contains the command line app. Why does this file exist, and why not put this in __main__? You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice: - When you run `python -msmartass` python will execute ``__main__.py`` as a s...
StarcoderdataPython
1988210
<gh_stars>100-1000 import os import numpy as np import scipy.io as sio from PIL import Image from deephar.data.datasets import get_clip_frame_index from deephar.utils import * ACTION_LABELS = None def load_h36m_mat_annotation(filename): mat = sio.loadmat(filename, struct_as_record=False, squeeze_me=True) #...
StarcoderdataPython
1839748
<gh_stars>0 from setuptools import setup, find_packages from pocketbook import __version__ setup( name='pocketbook', version=__version__, description='Command line wallet application for the Fetch.ai network', url='https://github.com/fetchai/tools-pocketbook', author='<NAME>', author_email='<EM...
StarcoderdataPython
6604755
from scraper import * s = Scraper(start=231660, end=233441, max_iter=30, scraper_instance=130) s.scrape_letterboxd()
StarcoderdataPython
3347908
from __future__ import absolute_import from . import Tracker class IdentityTracker(Tracker): def __init__(self): super(IdentityTracker, self).__init__( name='IdentityTracker', is_deterministic=True) def init(self, image, box): self.box = box def update(self, ima...
StarcoderdataPython
12855560
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
StarcoderdataPython
6494807
<gh_stars>1-10 """ https://leetcode.com/problems/to-lower-case/ Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" Example 2: Input: "here" Output: "here" Example 3: Input: "LOVELY" Output: "lovely" """ # time comp...
StarcoderdataPython