id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
114203
# Non-parametric optimization.<br> # Find interesting bits. Combine them. Repeat.<br> # [home](http://menzies.us/bnbab2) :: [lib](http://menzies.us/bnbad2/lib.html) :: # [cols](http://menzies.us/bnbad2/tab.html) :: [tbl](http://menzies.us/bnbad2/grow.html)<br> # <hr> # <a href="http://github.com/timm/bnbad2"><i...
StarcoderdataPython
1617001
<reponame>piotr-rusin/spam-lists # -*- coding: utf-8 -*- """Tests for functions and classes defined in spam_lists.structures.""" from __future__ import unicode_literals # pylint: disable=redefined-builtin from builtins import str, range, object from nose_parameterized import parameterized from spam_lists.exceptions i...
StarcoderdataPython
3270646
<gh_stars>0 from pygamescanner.util.proxy_transport import ProxyTransport from pygamescanner.gamespy2 import GameSpy2 def query_server(address, port, get_players, get_rules): s = GameSpy2() s.transport = ProxyTransport((address, port), s.packet_size) s.send_status_query(address, port) return s.dat...
StarcoderdataPython
1767591
<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-04-05 10:36 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pdata_app', '0017_settings_base_output_dir'), ] operations = [ mi...
StarcoderdataPython
22842
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import numpy as np from maro.rl import AbstractStateShaper class ECRStateShaper(AbstractStateShaper): def __init__(self, *, look_back, max_ports_downstream, port_attributes, vessel_attributes): super().__init__() self._look_...
StarcoderdataPython
1726138
<reponame>softwarefactory-project/DLRN<filename>dlrn/api/__init__.py # 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 a...
StarcoderdataPython
1658056
<filename>Lib/unittest/suite.py """TestSuite""" zaimportuj sys z . zaimportuj case z . zaimportuj util __unittest = Prawda def _call_if_exists(parent, attr): func = getattr(parent, attr, lambda: Nic) func() klasa BaseTestSuite(object): """A simple test suite that doesn't provide klasa albo module sha...
StarcoderdataPython
3378783
import serial import socket class BaseDriver: def __init__(self, *args, **kargs): self._open = False self.kargs = kargs self.init() self._open = True def __enter__(self): try: if not self._open: self.init() except: # noqa ...
StarcoderdataPython
3250656
import torch import pandas as pd import itertools from time import time,time_ns import matplotlib.pyplot as plt PARAMS = { "nll": 1, # number of linear layers composing the affine members "ncl": 3, # number of affince compling layers, must be larger then 3! "dim": [48,60,72,84,96], # dimension of system, f...
StarcoderdataPython
3309655
from django.contrib import admin from django import forms from mptt.admin import MPTTModelAdmin from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.admin import GenericTabularInline, GenericStackedInline, GenericInlineModelAdmin from .models import Menu, MenuItem from .forms impo...
StarcoderdataPython
3296468
# # @file TestReadMathML.py # @brief Read MathML unit tests # # @author <NAME> (Python conversion) # @author <NAME> # # ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ====== # # DO NOT EDIT THIS FILE. # # This file was generated automatically by converting the file located at # src/math...
StarcoderdataPython
3289082
import sys sys.setrecursionlimit(10**6) n, q = [int(_) for _ in input().split()] adj = [[] for i in range(n)] lvl = [0] * n for i in range(n - 1): a, b = [int(_) for _ in input().split()] adj[a - 1].append(b - 1) adj[b - 1].append(a - 1) visited = [False] * n def dfs(node): if visited[node]: ...
StarcoderdataPython
3375337
<filename>StdManipulator/JARA_ARM/__init__.py # DO NOT EDIT THIS FILE! # # Python module JARA_ARM generated by omniidl import omniORB omniORB.updateModule("JARA_ARM") # ** 1. Stub files contributing to this module import ManipulatorCommonInterface_Common_idl import ManipulatorCommonInterface_DataTypes_idl import Mani...
StarcoderdataPython
4808671
<gh_stars>10-100 from django.apps import AppConfig class DistrictsConfig(AppConfig): name = 'districts'
StarcoderdataPython
3203937
import threading import time from math import pi, sqrt from timer import Timer from pid import PID class MotionController: def __init__(self, odometer, motors, timeStep = .02): self.timeStep = timeStep self.odometer = odometer self.odometer.timeStep = self.timeStep self.motors = m...
StarcoderdataPython
3366089
import RPi.GPIO as gp import os gp.setwarnings(False) gp.setmode(gp.BOARD) gp.setup(7, gp.OUT) gp.setup(11, gp.OUT) gp.setup(12, gp.OUT) def main(): print('Start testing the camera A') i2c = "i2cset -y 1 0x70 0x00 0x04" os.system(i2c) gp.output(7, False) gp.output(11, False) gp.output(12, Tr...
StarcoderdataPython
136548
<filename>autolens/pipeline/phase/phase_galaxy.py<gh_stars>0 from astropy import cosmology as cosmo import autofit as af from autoastro.galaxy import fit_galaxy from autoastro.galaxy import masked_galaxy_data from autolens.pipeline.phase import abstract from autolens.pipeline import visualizer class Analysis(af.Anal...
StarcoderdataPython
115122
import re import requests from bs4 import BeautifulSoup from django.http import HttpResponseRedirect from django.shortcuts import render best_websites_data = ['https://analytics.moz.com', 'https://youcandothecube.com', 'https://www.wikihow.com', 'https://www.wired.com', 'https://www.samsung.com'...
StarcoderdataPython
3323410
from django.urls import path from .views import ( UserView, user_edit, user_delete, address_new, address_edit, address_delete, address_list ) app_name = 'users' urlpatterns = [ path('new/', UserView.as_view()), path('edit/<int:pk>/', user_edit, name='edit'), path('delete/<int:pk>/', user_delete, na...
StarcoderdataPython
3330480
<gh_stars>1000+ # 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. #------------------------------------------------------...
StarcoderdataPython
3327207
<filename>ex5_regularized_linear_regressionand_bias_vs_variance/trainLinearReg.py<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np # TRAINLINEARREG Trains linear regression given a dataset (X, y) and a # regularization parameter lambda # [theta] = TRAINLINEARREG (X, y, lambda) trains li...
StarcoderdataPython
3253118
<reponame>pmontgo33/lawn-care-planner # -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-11-16 19:43 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('planner', '0005_auto_20161108_1831'), ] opera...
StarcoderdataPython
3375345
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 30 17:31:12 2017 @author: ert """ import numpy as np import matplotlib.pyplot as plt data1 = np.loadtxt('orbit_test_magfie.out') data2 = np.loadtxt('orbit_test_magfie_neo.out') #for k in range(1,data1.shape[1]): for k in range(12,15):...
StarcoderdataPython
3228688
<gh_stars>1-10 def get_sql(company, conn, start_date, end_date, gl_code): # sql = (""" # SELECT # cl.tran_date # , cl.gl_code # , cl.source_code # , COALESCE(cl.tran_day, 0) AS "[REAL2]" # FROM # (SELECT tots.tran_date, tots.gl_code, ...
StarcoderdataPython
147581
from typing import List from volatility import framework from volatility.framework import interfaces, renderers from volatility.framework.interfaces import plugins class FrameworkInfo(plugins.PluginInterface): """Plugin to list the various modular components of Volatility""" @classmethod def get_require...
StarcoderdataPython
3369767
<filename>test/dsdl/test_common.py # # Copyright (C) 2014-2015 UAVCAN Development Team <uavcan.org> # # This software is distributed under the terms of the MIT License. # # Author: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # import os import unittest from dronecan.dsdl import common class TestCRC16FromBytes(unit...
StarcoderdataPython
3311864
from typing import List, Optional from pypi_org.nosql.packages import Package from pypi_org.nosql.releases import Release def get_latest_releases(limit=10) -> List[Release]: releases = Release.objects(). \ order_by("-created_date"). \ limit(limit). \ all() return releases def get_pa...
StarcoderdataPython
196593
import os import re import traceback import importlib from shlex import split from types import ModuleType from typing import TYPE_CHECKING, Dict, Optional, Tuple, Set, Pattern import discord from . import log from .command import BaseCommand, CommandResult from .context import Context from .arguments import Argumen...
StarcoderdataPython
2070
""" Project for Udacity Danaodgree in Deep Reinforcement Learning This script train an agent to navigate (and collect bananas!) in a large, square world. A reward of +1 is provided for collecting a yellow banana, and a reward of -1 is provided for collecting a blue banana. Thus, the goal of your agent is to collect a...
StarcoderdataPython
1733584
from django.urls import path, include from . import views from Book import views as book_views from Category import views as category_views from Comment import views as comment_views from Image import views as image_views urlpatterns = [ path("", views.index, name="Api"), path("books/", book_views.BookList, ...
StarcoderdataPython
3383377
import numpy as np import pandas as pd import pymongo import pdb from datetime import datetime, timedelta from scipy.io import loadmat import os import glob import logging def create_collection(dbName='argo', collectionName='kuusela'): dbUrl = 'mongodb://localhost:27017/' client = pymongo.MongoClient(dbUrl) ...
StarcoderdataPython
1618682
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import re import json import logging from datetime import datetime from twitter import TwitterSession class Cache(): def __init__(self, path): self.path = path if not os.path.exists(path): os.mkdir(path) if not os.path.is...
StarcoderdataPython
3209200
import pytest import numpy as np import jax import pyscf from pyscfad import gto from pyscfad.lib import numpy as jnp TOL_VAL = 1e-12 TOL_NUC = 1e-10 TOL_CS = 1e-10 TOL_EXP = 1e-9 TOL_NUC2 = 5e-9 TEST_SET = ["int1e_ovlp", "int1e_kin", "int1e_nuc", "int1e_rinv",] TEST_SET_ECP = ["ECPscalar"] TEST_SET_NUC =...
StarcoderdataPython
3244764
<gh_stars>0 from typing import Generic, Iterable, Optional, Tuple, TypeVar from flask import current_app, render_template, url_for from flask_saml2.signing import Digester, RsaSha1Signer, Sha1Digester, Signer from flask_saml2.types import X509, PKey from flask_saml2.utils import certificate_to_string, import_string ...
StarcoderdataPython
3214044
#!/usr/bin/python3 from scrapers.scrape import scrape_page # if you want to use this scraper without the RESTful api webservice then # change this import: from scrape import scrape_page import re try: import pandas as pd pandasImported = True except ImportError: pandasImported = False BASE_URL = "http://...
StarcoderdataPython
3368058
<reponame>berndfinger/leapp-repository<gh_stars>0 import logging import os from leapp.repository.manager import RepositoryManager from leapp.repository.scan import find_and_scan_repositories from leapp.utils.repository import find_repository_basedir, get_repository_id logger = logging.getLogger(__name__) logging.getL...
StarcoderdataPython
1700075
<filename>access-control/insecure-direct-object-references.py """ https://portswigger.net/web-security/access-control/lab-insecure-direct-object-references """
StarcoderdataPython
3324972
import math import logging from treehopper.api import DeviceCommands from treehopper.api.interfaces import Pwm from treehopper.api.pin import Pin, PinMode from treehopper.utils import utils class HardwarePwm(Pwm): """Hardware PWM module.""" ## \cond PRIVATE def __init__(self, pin: 'Pin'): self._...
StarcoderdataPython
3264610
# ------------------------------------------------------------------------------------------------ # # MIT License # # # # Copyright (c) 2...
StarcoderdataPython
81293
<reponame>saurabnigam/django-keycloak # Generated by Django 2.2.12 on 2020-04-21 18:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('django_keycloak', '0006_remove_client_service_account'), ] operations = [ migrations.AddField( ...
StarcoderdataPython
1643521
<filename>src/gui.py from tkinter import * import v2v from threading import Thread # GUI # dropdown to pick a voice # dropdown for speed # drag bar for volume # textbox to type, senses the enter key # On and Off button # minimize to system tray # new border that can move the app window # background color: class A...
StarcoderdataPython
1750051
import unittest from parameterized import parameterized_class from toscametrics.general.num_keys import NumKeys yaml_2_1 = 'tosca_definitions_version: tosca_simple_yaml_1_2\n\ndescription: Template for deploying a single server ' \ 'with MySQL software on top. ' yaml_19_1 = 'tosca_definitions_version: tosca...
StarcoderdataPython
1769613
import json import facilities import pandas as pd import projects import users_and_facilities import users_and_projects # Todo: address pandas warning w/out silencing pd.options.mode.chained_assignment = None # Define years over which compliance data will be considered and where to find it reporting_periods = ['2013...
StarcoderdataPython
1767590
<reponame>aidden-laoch/sabre<gh_stars>1-10 from covertutils.crypto.algorithms import CyclingAlgorithm from binascii import crc32 import struct class Crc32CyclingAlgorithm ( CyclingAlgorithm ) : def __crc32bytes( self, inp ) : try : # Python2/3 kung fu res = struct.pack('<I', crc32(inp) ) except struct.err...
StarcoderdataPython
21654
<reponame>Leviosar/tt import tweepy from .interface import show_message, show_tweet, show_user def dm(api: tweepy.API, target: str, content: str): """ Sends a direct message to target user Keyword arguments: api -- API instance for handling the request target -- Target user's scr...
StarcoderdataPython
3345034
<reponame>nicolasochem/openstacksdk<gh_stars>0 # 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 agree...
StarcoderdataPython
1708348
<filename>cellsites.py import threading import logging import numpy as np from sklearn.cluster import KMeans class CellSites: ''' CellSites considers each cluster from the Settlements class and performs K-Means clustering to identify the appropriate location for each cell site ''' settlements = np....
StarcoderdataPython
1704647
''' Created on Feb 13, 2012 @author: fmertens ''' import numpy as np import nputils import imgutils import wavelets def get_wavelet_obj(w): if isinstance(w, str): return wavelets.get_wavelet(w) if isinstance(w, wavelets.WaveletBase): return w raise ValueError("w is not a correct wavelet...
StarcoderdataPython
3391838
import argparse from pydub import AudioSegment # Get command line arguments parser = argparse.ArgumentParser() parser.add_argument('-t', help='Time in milliseconds for each chunk. Default: 10000', nargs='?', type=int, dest='chunk_size', default=10000) parser.add_argument('-i', '--inputfile', help='Input .wav fil...
StarcoderdataPython
4077
<gh_stars>1-10 load("@wix_oss_infra//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external") def dependencies(): import_external( name = "org_specs2_specs2_fp_2_12", artifact = "org.specs2:specs2-fp_2.12:4.8.3", artifact_sha256 = "777962ca58054a9ea86e294e025453ecf3...
StarcoderdataPython
1661944
<filename>examples/preprocess_text/app.py import re from enum import Enum from typing import Set import nltk from pydantic import BaseModel, Field try: EN_STOP_WORDS = set(nltk.corpus.stopwords.words("english")) except LookupError: nltk.download("stopwords") EN_STOP_WORDS = set(nltk.corpus.stopwords.words...
StarcoderdataPython
3386406
<gh_stars>1-10 ''' synbiochem (c) University of Manchester 2015 synbiochem is licensed under the MIT License. To view a copy of this license, visit <http://opensource.org/licenses/MIT/>. @author: neilswainston ''' # pylint: disable=too-many-public-methods import unittest import synbiochem.utils.chem_utils as chm_u...
StarcoderdataPython
48093
<filename>01-Apprenez/4.06b.py #!/usr/bin/env python3 # coding: utf-8 # $Id: 4.06b.py 1.2 $ # SPDX-License-Identifier: BSD-2-Clause """ Réseau (TCP) """ import socket import select hote = '' port = 12800 connexion_principale = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connexion_principale.bind((hote, port...
StarcoderdataPython
95136
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
StarcoderdataPython
23817
# -*- coding: utf-8 -*- __all__ = ( "extract_directory", "cleanup_data_directory", "dataset_schema", "validate_directory", "validate_directory_against_xsd", ) from .extract_ecospold2 import extract_ecospold2_directory from ..filesystem import check_cache_directory, get_from_cache, cache_data import...
StarcoderdataPython
73192
<gh_stars>100-1000 #!/usr/bin/env python from __future__ import print_function # Author: <NAME> <<EMAIL>> # Copyright (c) 2015 Intel Corporation. # # 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 Soft...
StarcoderdataPython
195080
# Returns index of x in arr if present, else -1 def binarySearch (arr, l, r, x): # Check base case if r >= l: mid = l + (r - l)/2 # If element is present at the middle itself if arr[mid] == x: return mid # If element is smaller than mid, then it # can only be present in left subarray ...
StarcoderdataPython
3319174
<reponame>Zabanaa/travis-ci-pypi-deploy-test<gh_stars>0 import codecs import os from setuptools import setup here = os.path.abspath(os.path.dirname(__file__)) def long_desc(root_path): filepath = os.path.realpath(os.path.join(root_path, 'README.rst')) with codecs.open(filepath, mode='r') as f: return...
StarcoderdataPython
3389865
# Time complexity: O(log(x)) # Approach: Reversing number logic = ans * 10 + num % 10 class Solution: def reverse(self, x: int) -> int: intMin, intMax = -(2**31), 2**31 - 1 sign = -1 if x < 0 else 1 x = abs(x) ans = 0 while x != 0: rem = x % 10 x //= ...
StarcoderdataPython
1676343
import pytest from vdirsyncer.cli.discover import expand_collections missing = object() @pytest.mark.parametrize('shortcuts,expected', [ (['from a'], [ ('c1', ({'type': 'fooboo', 'custom_arg': 'a1', 'collection': 'c1'}, {'type': 'fooboo', 'custom_arg': 'b1', 'collection': 'c1'})), ...
StarcoderdataPython
1611456
<gh_stars>0 from .mgcvae import Mode from .trajectron_plus_plus import TrajectronPlusPlus
StarcoderdataPython
3211446
<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- # # Script that parses the output from the febio and opendihu scenarios and computes a total error import sys, os import py_reader import numpy as np #print(os.getcwd()) # load data data1 = py_reader.load_data(["build_release/out/febio_0000001.py"]) data2...
StarcoderdataPython
3325276
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Cityparcelator (c) 2016 Copyright <NAME> <<EMAIL>> Portions copyright (c) 2010 by <NAME> Portions copyright (c) 2009 The Super Effective Team Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in co...
StarcoderdataPython
1664933
from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.test import TestCase from chamber.multidomains.domain import Domain, get_current_domain, get_domain, get_domain_choices, get_user_class from chamber.multidomains.urlresolvers import reverse from germanium.tools import...
StarcoderdataPython
185060
# -*- coding: utf-8 -*- from lxml import etree from datetime import date import traceback import time import sys import re from des_js import des_encode # 这段代码是用于解决中文报错的问题 reload(sys) sys.setdefaultencoding("utf8") from dateutil.relativedelta import relativedelta if __name__ == '__main__': sys.path...
StarcoderdataPython
1741583
<gh_stars>0 import functools import io import inspect import json import gzip from base64 import b64decode from http.cookies import SimpleCookie import chardet import rfc3986 import graphene import yaml from requests.structures import CaseInsensitiveDict from requests.cookies import RequestsCookieJar from starlette.d...
StarcoderdataPython
3273361
from rest_framework import serializers TAB_CHOICES = ( ("mobile", "mobile"), ("desktop", "desktop"), ) PGS_LANG_CHOICES = ( ("ar", "Arabic"), ("bg", "Bulgarian"), ("ca", "Catalan"), ("zh-TW", "Traditional Chinese (Taiwan)"), ("zh-CN", "Simplified Chinese"), ("hr", "Croatian"), ("c...
StarcoderdataPython
3281027
<reponame>rupei/probability # Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
StarcoderdataPython
1680359
<filename>labcontrol/gui/handlers/process_handlers/library_prep_shotgun_process.py # ---------------------------------------------------------------------------- # Copyright (c) 2017-, LabControl development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, ...
StarcoderdataPython
1718016
##################################### # <NAME> 2/28/18 # CSC 131-005 Lab 6 ##################################### # Semester GPA Calculation # Purpose: This program will calculate a student’s semester grade # by using the students previous credits/GPA and then asking the student ...
StarcoderdataPython
54424
""" This file contains quantum code in support of Shor's Algorithm """ """ Imports from qiskit""" from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister import sys import math import numpy as np """ ********* QFT Functions *** """ """ Function to create QFT """ def create_QFT(circuit,up_reg,n,with_sw...
StarcoderdataPython
110747
import sys # True if we are running on Python 3. PY3 = sys.version_info[0] == 3 PY26 = sys.version_info[0] == 2 and sys.version_info[1] == 6 if PY3: from io import BytesIO as StringIO from urllib.parse import urlparse else: from urlparse import urlparse # noqa from cStringIO import StringIO # noqa ...
StarcoderdataPython
1618159
<filename>src/constants.py """Defines different constants being used in the project """ INFO_MESSAGE_FORMAT = "%(message)s" DEBUG_MESSAGE_FORMAT = "%(levelname)s|%(filename)s:%(lineno)s|%(asctime)s|%(message)s" DATE_FORMAT = "%H:%M:%S" DEFAULT_DBM_ANT_VALUE = -135 ANTENNA_IDS = [201, 202, 203, 204, 205, 206] RESULTS_F...
StarcoderdataPython
3282903
<reponame>FinnStutzenstein/openslides-backend<filename>tests/system/action/motion_block/test_delete.py from openslides_backend.permissions.permissions import Permissions from tests.system.action.base import BaseActionTestCase class MotionBlockActionTest(BaseActionTestCase): def test_delete_correct(self) -> None: ...
StarcoderdataPython
3237444
# Copyright (c) 2011, <NAME>, <NAME>, TU Darmstadt # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list ...
StarcoderdataPython
3314109
<filename>html/pelicanconf.py #!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = u'<NAME>' SITENAME = u'500 Lines or Less' SITEURL = '' TIMEZONE = 'Europe/Paris' DEFAULT_LANG = u'en' # Feed generation is usually not desired when developing FEED_ALL_ATOM = N...
StarcoderdataPython
3312825
<gh_stars>0 from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from rest_framework import viewsets from rest_framework import filters from profiles_api import serializers from profiles_api import models from rest_framework.authtoken.views import Obtai...
StarcoderdataPython
73834
import django from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ from django_jsonfield_backport import features, forms, models class JSONFieldConfig(AppConfig): name = "django_jsonfield_backport" verbose_name = _("JSONField backport from Django 3.1") def ready(self...
StarcoderdataPython
3226762
<reponame>iRi-E/BEER<gh_stars>1-10 # Copyright (c) 2020 BlenderNPR and contributors. MIT license. from os import path from Malt.GL import * from Malt.Pipeline import Pipeline from Malt.Mesh import Mesh from Malt.Shader import Shader from Malt.Texture import Texture from Malt.RenderTarget import RenderTarget from Malt...
StarcoderdataPython
167030
import subprocess ips = [ "172.16.0.96", "172.16.0.95", "172.16.0.94", "172.16.0.93", "172.16.0.92", "172.16.0.91", "172.16.0.90", "172.16.0.89", "172.16.0.88", "172.16.0.87", "172.16.0.86", "172.16.0.85", "172.16.0.84", "172.16.0.83", "172.16.0.82", "172.16.0.81", "172.16.0.80", "172.16.0.79", "172.16.0.78", "172.16....
StarcoderdataPython
3308643
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
StarcoderdataPython
3261109
import io import os import pickle import numpy as np import torch from PIL import Image from learn2learn.vision.datasets import TieredImagenet class TieredImageNet(TieredImagenet): def __init__(self, root, partition="train", mode='coarse', transform=None, target_transform=None, download=False): self.root...
StarcoderdataPython
127048
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- Python -*- """ @file CsvWrite.py @brief ModuleDescription @date $Date$ """ import sys import time import re import csv import datetime import time import math pattern = re.compile('\d+\,\d+\,\d+') sys.path.append(".") # Import RTM module import RTC import OpenR...
StarcoderdataPython
3329605
# This function is to deal with the dependence linear regression module needs. import os import sys def find_root(repo="fedlearn-algo"): root = os.getcwd() folders = root.split('/') last = len(folders)-1 while last>=0: if folders[last].lower()==repo.lower(): break else: ...
StarcoderdataPython
3236137
from .gameplay import hollywood_medium, bollywood_medium, bollywood_hard, hollywood_hard, hollywood_easy, bollywood_easy def game_level(): print("\t\t\tSelect Difficulty") print("Press '1' for Easy") print("Press '2' for Medium") print("Press '3' for Hard") lvl = int(input()) val_level= [1,2,3]...
StarcoderdataPython
3356416
<filename>src/DoingMathInPython/ch_04/graphs.py<gh_stars>0 ''' Plot the Input of an Expression ''' from sympy import Symbol, sympify, solve from sympy.core import SympifyError from sympy.plotting import plot def plot_expression( expr ): y = Symbol( 'y' ) solutions = solve( expr, y ) expr_y = solutions[ 0 ] plot...
StarcoderdataPython
3271262
from Depth_3DDFA_V2.TDDFA import TDDFA from Depth_3DDFA_V2.utils.serialization import ser_to_ply from open3d import read_point_cloud, draw_geometries import cv2 import numpy as np import pandas as pd import yaml import time import sys from retinaface.retinaface import RetinaFace ''' This is an abstraction of 3DDF...
StarcoderdataPython
1779350
import hashlib from django.db import models class UnresolvedQuestions(models.Model): question = models.TextField() def __str__(self): return self.question class Key(models.Model): name = models.CharField(max_length=100, unique=True, db_index=True) enabled = models.BooleanField(default=False...
StarcoderdataPython
3312853
from sympy import S from sympy.physics.units import Quantity, mass, kg, year, Dimension _factor = {'': 1, 'k': 1000, 'M': 1_000_000, 'G': 1_000_000_000} _names = {'': '', 'k': 'kilo', 'M': 'mega_', 'G': 'giga_'} One = S.One def scale(base, kind, prefixes="", multiplier=1): """ Define a scale of similar quant...
StarcoderdataPython
1691828
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Plot NBA Data for 2014-2015 Age by position box plots """ import sys import csv import argparse import plotly.plotly as py from plotly.graph_objs import Data, Layout, YAxis, XAxis from plotly.graph_objs import Figure, Box, Marker, Line POSITIONS = { 'PF': 'Power...
StarcoderdataPython
3297480
<gh_stars>0 # Generated by Django 3.0.3 on 2020-08-02 11:43 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('guidebook', '0009_auto_20200802_1236'), ] operations = [ migrations.RemoveField( model_name='pointofinterest', n...
StarcoderdataPython
28965
<reponame>cdleary/bazel_rules_hdl<filename>tools/test_everything.py #!/usr/bin/env python3 # Copyright 2020 Google LLC # # 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.apac...
StarcoderdataPython
3257874
from dotenv import load_dotenv import os load_dotenv() ELASTICSEARCH_HOST = os.getenv('ELASTICSEARCH_HOST') BACKEND_HOST = os.getenv('BACKEND_HOST') BACKEND_EMAIL = os.getenv('BACKEND_EMAIL') BACKEND_PASSWORD = os.getenv('BACKEND_PASSWORD')
StarcoderdataPython
1789686
<filename>src/wai/annotations/main/commands/__init__.py """ Package containing the available sub-commands for wai.annotations. """ from ._commands import get_command_main, list_commands from ._typing import CommandMain
StarcoderdataPython
4840308
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import datetime import sys reload(sys) sys.setdefaultencoding('utf-8') class SpiderPipeline(object): def process_item(self...
StarcoderdataPython
3256205
from automata import * class MetaNode(object): def __init__(self, label='', sourceNodes=()): self._node = Node(label) self._setLabel(label) self._sourceNodes = set() for n in sourceNodes: self.addSourceNode(n) def _setLabel(self, val): ...
StarcoderdataPython
3322930
<reponame>HypnosXC/mmaction2 import pytest import torch from mmaction.models import Conv2plus1d def test_conv2plus1d(): with pytest.raises(AssertionError): # Length of kernel size, stride and padding must be the same Conv2plus1d(3, 8, (2, 2)) conv_2plus1d = Conv2plus1d(3, 8, 2) conv_2plu...
StarcoderdataPython
3321731
<filename>manage.py hello = "hello" def foo(): hello = "world" print(hello) foo()
StarcoderdataPython
3245506
""" Processes player selections and converts them to the format used by KQStream (from kq-stats repo) """ TEAM_KEY = "team" CHARACTER_KEY = "character" USER_KEY = "user" CHARACTERS_BY_TEAM = { "gold": { "queen": 1, "stripes": 3, "abs": 5, "skull": 7, "checke...
StarcoderdataPython
3274846
<reponame>sasgc6/pysmurf import pysmurf import numpy as np import matplotlib.pyplot as plt S = pysmurf.SmurfControl(setup=False, cfg_file='/usr/local/controls/Applications/smurf/pysmurf/pysmurf/cfg_files/experiment_kx_mapodaq.cfg',make_logfile=False) tones = np.arange(5,16) freq = 5193.799997...
StarcoderdataPython