id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3303019
# Generated by Django 2.2.16 on 2020-09-23 18:08 from django.db import migrations import django_jsonfield_backport.models class Migration(migrations.Migration): dependencies = [ ('files', '0003_webextpermission_optional_permissions'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
3330130
from itertools import combinations from typing import List import numpy as np from numpy.typing import ArrayLike from dexp.utils import xpArray from dexp.utils.backends import Backend __all__ = [ "first_derivative_func", "first_derivative_kernels", "second_derivative_func", "second_derivative_kernels...
StarcoderdataPython
9713
<gh_stars>10-100 """ Base pipeline class. Main rule generator classes inherit from this one. """ from copy import deepcopy from typing import List, Tuple, Union, Dict from iguanas.pipeline.class_accessor import ClassAccessor from iguanas.utils.typing import PandasDataFrameType, PandasSeriesType import iguanas.utils.uti...
StarcoderdataPython
3336358
<filename>DartDeep/hptf/ppo.py import tensorflow as tf import numpy as np from DartDeep.dart_env_v2_1 import HpDartEnv import pydart2 from itertools import count from collections import deque from random import random, sample from multiprocessing import Process, Pipe from copy import deepcopy class Replay(deque): ...
StarcoderdataPython
126410
<filename>passwords/type7.py import sys V = [0x64, 0x73, 0x66, 0x64, 0x3b, 0x6b, 0x66, 0x6f, 0x41, 0x2c, 0x2e, 0x69, 0x79, 0x65, 0x77, 0x72, 0x6b, 0x6c, 0x64, 0x4a, 0x4b, 0x44, 0x48, 0x53, 0x55, 0x42, 0x73, 0x67, 0x76, 0x63, 0x61, 0x36, 0x39, 0x38, 0x33, 0x34, 0x6e, 0x63, 0x78, 0x76, 0x39, 0x38, 0x37, 0x33...
StarcoderdataPython
1722569
<reponame>jcalcutt/notes<gh_stars>0 from django.shortcuts import render, redirect def welcome(request): if request.user.is_authenticated: return redirect('user_home') else: return render(request, 'notes/welcome.html')
StarcoderdataPython
1650879
""" Testshot script for getting GPI equipment ready while still at MIT. Usage : python testgpi_mit.py 1180227500 <NAME>, Feb 27, 2018 """ from MDSplus import * from MitDevices.acq132 import ACQ132 from MitDevices.acq196 import ACQ196 from MitDevices.acq196ao import ACQ196AO import numpy as np import sys import time...
StarcoderdataPython
43187
from selenium import webdriver def main(): driver = webdriver.Chrome() driver.get('http://127.0.0.1:8000/places/default/search') driver.find_element_by_id('search_term').send_keys('.') driver.execute_script("document.getElementById('page_size').options[1].text = '1000'") driver.find_element_by_id(...
StarcoderdataPython
1778146
import bpy import os blend_file_path = bpy.data.filepath directory = os.path.dirname(blend_file_path) file_name = os.path.splitext(os.path.basename(blend_file_path))[0] bpy.ops.export_scene.obj( filepath=os.path.join(directory, 'compressed', file_name + '.obj'), check_existing=True, axis_forward='Z', ...
StarcoderdataPython
145303
from foundations_spec import * class TestBucketPipelineArchive(Spec): @let def bucket_klass(self): klass = ConditionalReturn() klass.return_when(self.bucket, *self.constructor_args, **self.constructor_kwargs) return klass bucket = let_mock() @let def constructor_args...
StarcoderdataPython
3326260
from office365.actions.upload_session_query import UploadSessionQuery from office365.outlook.mail.attachment_item import AttachmentItem from office365.outlook.mail.attachment_type import AttachmentType class AttachmentUploadQuery(UploadSessionQuery): """Create an upload session to allow your app to upload attachm...
StarcoderdataPython
137368
import bokeh import pandas as pd import numpy as np import os from bokeh import events from bokeh.io import show from bokeh.plotting import figure, output_file, ColumnDataSource from bokeh.models.widgets import ColorPicker, Select, Toggle, Dropdown, DataTable, NumberFormatter, TableColumn,TextInput, Button, TextAreaInp...
StarcoderdataPython
3349522
<reponame>lffloyd/OCTIS<filename>octis/models/ETM.py from __future__ import print_function from octis.models.early_stopping.pytorchtools import EarlyStopping import torch import numpy as np from octis.models.ETM_model import data from sklearn.feature_extraction.text import CountVectorizer from torch import nn, optim fr...
StarcoderdataPython
1622864
<gh_stars>0 from .base import BaseTest from posthog.models import Event, Person, Element, Action, ActionStep from freezegun import freeze_time # type: ignore class TestEvents(BaseTest): TESTS_API = True ENDPOINT = 'event' def test_filter_events(self): person = Person.objects.create(properties={'...
StarcoderdataPython
3345200
<filename>gralog-fx/src/main/java/gralog/gralogfx/piping/scripts/contractBetweenVertices.py<gh_stars>10-100 #!/usr/bin/python #ef.py from Gralog import * from bfs import populateBFS g = Graph("directed"); g.generateRandomGraph(15); v1 = g.requestVertex(); v2 = g.requestVertex(); populateBFS(g,v1); curr = v2.getPrope...
StarcoderdataPython
61431
# Generated by Django 3.2.7 on 2021-10-03 15:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sellers', '0001_initial'), ] operations = [ migrations.RenameField( model_name='seller', old_name='description', ...
StarcoderdataPython
3336569
#!/usr/bin/env python3 # <https://glom.readthedocs.io/en/latest/> import glom data = {"a": {"b": {"c": "d"}}} filter_result = glom.glom(data, spec="a.b.c") print(filter_result) # d try: glom.glom(data, spec='a.nope') except glom.core.PathAccessError as e: print(e) # glom.core.PathAccessError: error raised wh...
StarcoderdataPython
3206227
<filename>DQM/TrackingMonitor/python/LogMessageMonitor_cff.py import FWCore.ParameterSet.Config as cms import DQM.TrackingMonitor.LogMessageMonitor_cfi LocalRecoLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() LocalRecoLogMessageMon.pluginsMonName = cms.string ( 'LocalReco' ) LocalRecoL...
StarcoderdataPython
176744
<filename>olaf/user/tests.py<gh_stars>0 from django.test import TestCase, Client from django.shortcuts import reverse from django.db.models import signals from django.contrib.auth import get_user_model from olaf.tasks import send_sms_to import json User = get_user_model() class SignalTests(TestCase): def setU...
StarcoderdataPython
1632060
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from uncertainties import ufloat import uncertainties from uncertainties.unumpy import uarray from scipy.optimize import curve_fit import os # print("Cwd:", os.getcwd()) # print("Using matplotlibrc from ", mpl.matplotlib_fname()) fig = plt.f...
StarcoderdataPython
1601321
from .root import root
StarcoderdataPython
67566
<gh_stars>0 # (c) 2015, <NAME> <<EMAIL>> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. #...
StarcoderdataPython
3238650
<reponame>jordiae/DeepLearning-MAI import torch from typing import Tuple import torch.nn.functional as F import argparse import os import logging from torch import nn def load_arch(device: torch.device, args: argparse.Namespace) -> Tuple[torch.nn.Module, torch.nn.Module]: """ Returns initialized encoder and d...
StarcoderdataPython
3318374
import os import sys from nose.exc import SkipTest try: from pkg_resources import EntryPoint except ImportError: raise SkipTest("No setuptools available; skipping") here = os.path.dirname(__file__) support = os.path.join(here, 'support') ep = os.path.join(support, 'ep') def test_plugin_entrypoint_is_loadabl...
StarcoderdataPython
3221336
import json from rumps import application_support def reset_default_statistics(): """Called if stats file is missing and then writes statistics.json in the App Support folder""" with open("./static/default_stats.json", "r") as default_file: with open(f"{application_support('Duolingo Pomodoro')}/stati...
StarcoderdataPython
1706438
<filename>tests/mokcam/halerror.py<gh_stars>0 # test hal errors import pyb i2c = pyb.I2C(2, pyb.I2C.MASTER) try: i2c.recv(1, 1) except OSError as e: print(repr(e))
StarcoderdataPython
4807146
# © Copyright 2021, PRISMA’s Authors import numpy as np from prisma.spectrum import Spectrum BATTINFO_ID = '0XH81' def trimming(spectrum, within): """ Trim raw spectrum * within [float,float]: lower and upper limits of the range to be studied """ new_metadata = {'Process':'Trimming','Pr...
StarcoderdataPython
3336231
# coding: utf-8 import re def preg_split(pattern, subject): return re.split(pattern, subject) if __name__ == '__main__': keywords = preg_split(r'[\s,]+', 'hypertext language, programming') print(keywords)
StarcoderdataPython
3283899
<filename>c10.py from tkinter import * conduitType = ["Heavy duty rigid UPVC conduit", "Corflo conduit", "Medium duty corrugated", "Medium duty rigid UPVC conduit"] CableType = ["-", "1", "1.5", "2.5", "4" , "6" ,"10" ,"16", "25", "35", "50", "70" , "95" ,"120" ,"150","185","240","300", "400","500","630"] class App...
StarcoderdataPython
1625263
""" Mimic the Dataverse urls for testing - get user info - get DDI - download file """ from django.urls import path, re_path from opendp_apps.dataverses.views import manifest_test_params_view from opendp_apps.dataverses import mock_dv_views MOCK_API_PREFIX = 'api' MOCK_API_VERSION = 'v1' urlpatterns = [ re_path...
StarcoderdataPython
1721092
<filename>Proj1_HDR/task2_03_radiance_map.py import os import numpy as np import cv2 import matplotlib.pyplot as plt def read_images(directory, extension='png'): # Read all the files with OpenCV files = list([os.path.join(directory, f) for f in os.listdir(directory) if f[-3:] == extension]) files = sorted...
StarcoderdataPython
1715996
# Generated by Django 3.2.6 on 2021-09-04 03:07 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pwas', '0054_alter_pwa_manifest_json'), ] operations = [ migrations.AlterField( model_name='pwa', ...
StarcoderdataPython
3357307
#!/usr/bin/env python3 import cgi import cgitb cgitb.enable() from templates import login_page, secret_page, after_login_incorrect import secret import os from http.cookies import SimpleCookie # set up cgi form s = cgi.FieldStorage() username = s.getfirst("username") password = s.getfirst("password") # from this p...
StarcoderdataPython
4822573
<filename>graph_generation/config_params/connection_params.py class ConnectionParams: def __init__(self, system_write_connection_count, system_read_connection_count): self.system_write_connection_count = system_write_connection_count self.system_read_connection_count = system_read_connection_count ...
StarcoderdataPython
3306019
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging from d2go.export.api import PredictorExportConfig from d2go.utils.export_utils import ( D2Caffe2MetaArchPreprocessFunc, D2Caffe2MetaArchPostprocessFunc, D2RCNNTracingWrapper, ) from detectron2.exp...
StarcoderdataPython
85527
<reponame>amexias/code-vault import json import datetime class fileop: def __init__(self,Text): self.text=Text self.tlength=len(self.text) def writetext(self): with open('settings.txt', 'w') as json_file: json.dump(self.text, json_file) def...
StarcoderdataPython
3285322
from __future__ import ( absolute_import, unicode_literals, ) import codecs import sys from setuptools import ( find_packages, setup, ) from pysoa import __version__ def readme(): with codecs.open('README.rst', 'rb', encoding='utf8') as f: return f.read() install_requires = [ 'att...
StarcoderdataPython
1740989
<reponame>mickahell/websites import streamlit as st def app(): header = """ <div align="center"> <h1>Online Quantum Lab</h1> Here an online version of my Docker images for <b>Quantum development</b> and <b>Quantum experiments</b>. This platform is only for prototype, testing experimen...
StarcoderdataPython
81272
import psycopg2 import sys from handHud import * import time from psycopg2.extensions import AsIs import copy from multiprocessing import Pool import os def connection(): try: conn = psycopg2.connect(database="new", user="postgres", password="<PASSWORD>", host='localhost', ...
StarcoderdataPython
1721739
<reponame>controversial/SocialNPHS import os import livejson localdir = os.path.dirname(os.path.abspath(__file__)) dbpath = os.path.join(localdir, "users.json") students = livejson.File(dbpath, pretty=True, sort_keys=True)
StarcoderdataPython
55693
<gh_stars>10-100 from __future__ import absolute_import, unicode_literals import unittest from django.test import override_settings from wagtaildraftail import blocks, draft_text, forms, widgets class DraftailTextBlockTestCase(unittest.TestCase): def test_get_default_with_string_default(self): class S...
StarcoderdataPython
1747279
import machine import network import utime import bme280 import ambient ssid = "ess-id" password = "<PASSWORD>" i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4)) bme = bme280.BME280(i2c=i2c) am = ambient.Ambient(ch-id, 'write-key') station = network.WLAN(network.STA_IF) station.active(True) station.connect(s...
StarcoderdataPython
1762508
import torch.nn as nn from transformers import * class BertForRanking(nn.Module): def __init__(self): super(BertForRanking, self).__init__() model = model_class.from_pretrained('bert-base-uncased') feature_dim = 768 self.tanh = nn.Tanh() self.dense = nn.Linear(fea...
StarcoderdataPython
1662600
import re import sqlite3 import time ######################################################################### # Base class for generating a catebot response. This is intended to be a parent to classes that # implement each type of response with overrides specific to them. The classes that are expected to be # overrid...
StarcoderdataPython
87705
<reponame>maslychm/mighty from PIL import Image, ImageFont, ImageDraw import requests from io import BytesIO import os MAXPICSIZE = 300 def generate_onjoin_pic(namestr: str, member_id: int, url): """ Generates an image with user name and image and retuns the absolute path to the file """ # Check ...
StarcoderdataPython
3240733
# -*- coding: utf-8 -*- from __future__ import unicode_literals import logging import threading import uuid from django.conf import settings from django.http import HttpResponse, StreamingHttpResponse from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from guacamole.client impor...
StarcoderdataPython
127709
import dico client = dico.Client("YOUR_BOT_TOKEN") client.on_ready = lambda ready: print(f"Bot ready, with {len(ready.guilds)} guilds.") @client.on_message_create async def on_message_create(message: dico.Message): if message.content.startswith("!button"): button = dico.Button(style=dico.ButtonStyles.PR...
StarcoderdataPython
1722863
<gh_stars>0 from flask.ext import restful from db import db from uuid import uuid4, UUID from jobs.scrape import scrape from datetime import datetime, timedelta from pymongo import DESCENDING class DogScrape(restful.Resource): def post(self): jobs_cursor = db.jobs.find({}).sort('date', DESCENDING) ...
StarcoderdataPython
4813210
<reponame>rileyblackwell/company-growth-rates def castToFloat(num): notNum = True while notNum == True: try: num = float(num) notNum = False except: print(f"\"{num}\" is not a number\nEnter a number") num = input() return num def formatGrowthRat...
StarcoderdataPython
3360769
<reponame>guangbin79/Lua_5.1.5-Android<filename>zziplib-0.13.62/docs/zzipdoc/docbookdocument.py #! /usr/bin/env python # -*- coding: UTF-8 -*- from match import Match class DocbookDocument: """ binds some xml content page with additional markup - in this variant we set the rootnode container to 'reference' and...
StarcoderdataPython
1781963
import time import subprocess file_name = "output.txt" threshold = 30 vm_list = [] vm_cpuUtilization = {} def readGanglia(): """ This function open and reads data file from ganglia The data file is of the format ip_addr||cpu_utilization It parses the file and if at any point the cpu_utili...
StarcoderdataPython
3393344
<gh_stars>1-10 import requests from bs4 import BeautifulSoup def ask_anna(text="who are you"): url = "https://www.pandorabots.com/pandora/talk?botid=e6b3d89abe37ba83" data = { "input": text, "botcust2": "b170873d9e664911"} html = requests.post(url, data).text soup = BeautifulSoup(html,...
StarcoderdataPython
154376
<reponame>SandyChapman/pyright<filename>packages/pyright-internal/src/tests/samples/literals7.py # This sample tests the handling of very large integer values used in # literals. from typing import Literal # This should generate an error. y1: Literal[ 9000012312312314564879874564521321300000000000000000000000000...
StarcoderdataPython
70333
<gh_stars>0 import logging import torch import os from base_read_data import prepare_data, Sample, domain_slot_list, domain_slot_type_map, SampleDataset from base_model import BaseModel from base_config import args, DEVICE, medium_result_template, evaluation_folder, ckpt_template, logger import pickle import torch.mult...
StarcoderdataPython
3293106
<reponame>bytecrash/iromoozik<gh_stars>0 import os import pymongo from motor.motor_asyncio import AsyncIOMotorClient client = AsyncIOMotorClient(host=os.environ.get("mongodb://userWXA:UOQwEVhSarlqOdcW@mongodb/sampledb")) db = client.music def text_search(query): return db.tracks.find( { '$text': { '$se...
StarcoderdataPython
185707
<gh_stars>100-1000 # Licensed under the MIT license # http://opensource.org/licenses/mit-license.php # Copyright (C) 2006 Fluendo, S.A. (www.fluendo.com). # Copyright 2006,2007,2008,2009 <NAME> <<EMAIL>> from twisted.python import failure from twisted.python.util import OrderedDict from coherence import log class ...
StarcoderdataPython
3268642
<reponame>martinfleis/pysal import esda import giddy import inequality import pointpats import spaghetti import segregation
StarcoderdataPython
1612140
import jinja2 import flask_themes2 def get_global_theme_template(cache): @cache.memoize() def _get_templatepath(theme, templatename, fallback): templatepath = '_themes/{}/{}'.format(theme, templatename) if (not fallback) or flask_themes2.template_exists(templatepath): return templa...
StarcoderdataPython
3200157
# -*- coding: utf-8 -*- """ .. module:: test_login_view """ from django.test import TestCase from django.urls import reverse from rest_framework.test import APITestCase from apps.volontulo.factories import UserFactory ENDPOINT_URL = reverse('api_logout') class TestLogoutViewAuthenticated(APITestCase, TestCase): ...
StarcoderdataPython
3269228
<filename>dags/example_all.py """ Example DAG where rekcurd_airflow plugins are used """ import airflow from airflow import DAG from airflow.operators.python_operator import PythonOperator, BranchPythonOperator from airflow.operators.bash_operator import BashOperator from rekcurd_airflow.operators import EvaluationUplo...
StarcoderdataPython
3247953
from requests import Session def run(): print("Hello world!") if __name__ == '__main__': run()
StarcoderdataPython
68720
# -*- coding: utf-8 -*- # # jQuery File Upload Plugin GAE Python Example 1.1.5 # https://github.com/blueimp/jQuery-File-Upload # # Copyright 2011, <NAME> # https://blueimp.net # # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT # from __future__ import with_statement from google.appengine.api ...
StarcoderdataPython
3212484
from collections import namedtuple Colour = namedtuple("Colour", "r, g, b, a")
StarcoderdataPython
17525
<gh_stars>1-10 import os.path import pytest import py from pynpact.steps import extract def test_binfile_exists(): assert extract.BIN assert os.path.exists(extract.BIN) def test_plan(gbkconfig, executor): extract.plan(gbkconfig, executor) filename = gbkconfig[extract.OUTPUTKEY] assert filename ...
StarcoderdataPython
3264895
#!/usr/bin/env python import os from glob import glob from distutils.core import setup setup( name='ceres', version='0.10.0', url='https://github.com/graphite-project/ceres', author='<NAME>', author_email='<EMAIL>', license='Apache Software License 2.0', description='Distributable time-series database'...
StarcoderdataPython
111879
<gh_stars>0 from unittest import TestCase from uhlive.stream.conversation import Conversation, Ok, ProtocolError from .conversation_events import join_successful class TestConnection(TestCase): def test_join(self): client = Conversation("customerid", "myconv", "john_test") frame = client.join(mo...
StarcoderdataPython
3218136
#$ -S /netapp/home/xingjiepan/.local/bin/python3 ''' Empty script for debugging on SGE ''' import os import sys; sys.path.append(os.getcwd()) import benchmark_constructor as BC if __name__ == '__main__': os.environ['PATH'] = ':'.join(['/netapp/home/xingjiepan/.local/bin', os.en...
StarcoderdataPython
1713070
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Camino2Trackvis top level namespace """ from .convert import Camino2Trackvis, Trackvis2Camino
StarcoderdataPython
3372371
#In this script I will try to assess any possible difference #in treatment outcome across patients of different groups #(isolated with hierarchical clustering on snps genotypes) import pandas as pd from scipy import stats #importing table with treatment infos df_rr = pd.read_csv('./checks/delta_pl_ther.tsv', sep = '...
StarcoderdataPython
3303792
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2021 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA-Workflow-Engine-Snakemake command line interface.""" import logging import os from...
StarcoderdataPython
3359086
# -*- coding: utf-8 -*- from .atomic_permutation import AtomicPermutation from .atomic_permutation_ase import AtomicPermutationASE from .coordinate_perturation_ordered import CoordinateOrderedPerturbation from .coordinate_perturbation_ase import CoordinatePerturbationASE from .coordinate_perturbation import Coordinate...
StarcoderdataPython
122261
<filename>main.py<gh_stars>0 #!/usr/bin/env python # If you keep OpenSCAD in an unusual location, uncomment the following line of code and # set it to the full path to the openscad executable. # Note: Windows/python now support forward-slash characters in paths, so please use # those instead of backslashes which...
StarcoderdataPython
1618095
<reponame>b0bac/ApolloScanner<filename>Configuration/migrations/0013_serviceslog_method_serviceslog_status_and_more.py # Generated by Django 4.0.1 on 2022-03-10 12:03 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Configuration', '0012_alter_serviceslo...
StarcoderdataPython
3383160
import arcpy, os db = os.path.join(os.path.dirname(os.path.abspath(__file__)), r'eqedocsp.sde\AGRC.VW_DSHW_FACILITY') if arcpy.Exists(db): print('pass') else: print('fail')
StarcoderdataPython
187249
import os, csv class BaseConfig(object): MAINTENANCE = False
StarcoderdataPython
3202373
import unittest import os # noqa: F401 import json # noqa: F401 import time import requests from os import environ try: from ConfigParser import ConfigParser # py2 except: from configparser import ConfigParser # py3 from pprint import pprint # noqa: F401 from biokbase.workspace.client import Workspace ...
StarcoderdataPython
1641879
# encoding: utf-8 from .nhindex_agent import NHIndexAgent nh_agent = NHIndexAgent() def get_index_list(): return nh_agent.get_index_list() def get_index_daily(index_code): return nh_agent.get_index_daily(index_code) def get_index_snapshot(): return nh_agent.get_index_snapshot() def get_index_weight():...
StarcoderdataPython
3270601
s = input('Skriv inn strekningen s [m]: ') v = input('Skriv inn farta v [m/s]: ') s = float(s) v = float(v) t = s/v print(t)
StarcoderdataPython
1684913
<filename>examples/object_mgmt.py<gh_stars>10-100 """This is the demo script to show how administrator can manage folders, objects and their dependencies. This script will not work without replacing parameters with real values. Its basic goal is to present what can be done with this module and to ease its usage. """ ...
StarcoderdataPython
3208874
""" Collection of database access functions. """ import os import re import json import logging from pathlib import Path import tempfile from contextlib import contextmanager from collections import defaultdict import numpy as np import pandas as pd import sh from tqdm import tqdm from sqlalchemy import create_engi...
StarcoderdataPython
1760067
import unittest import pep8 class TestCodeFormat(unittest.TestCase): def test_pep8_conformance(self): """all packages, tests, and cookbook conform to PEP8""" pep8style = pep8.StyleGuide(quiet=True, exclude=['_version.py']) result = pep8style.check_files(['fatiando', 'test', 'setup.py', ...
StarcoderdataPython
110620
# # # Copyright 2019 Asylo 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 required by applicable law or agreed to in wri...
StarcoderdataPython
187310
#!/usr/bin/env python # encoding: utf-8 # # Copyright SAS Institute # # 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 b...
StarcoderdataPython
4814623
from gibson2.core.render.mesh_renderer import MeshRendererContext from gibson2.core.render.mesh_renderer.get_available_devices import get_available_devices def test_device(): assert len(get_available_devices()) > 0 def test_binding(): r = MeshRendererContext.MeshRendererContext(256, 256, get_available_devic...
StarcoderdataPython
78117
<gh_stars>0 import argparse from base64 import b64decode from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import SGDClassifier class Document: def __init__(self, id=0, url='', html='', mark=False): self.id = id self.url = url self.html = html s...
StarcoderdataPython
152136
<filename>echobot.py # -*- coding: UTF-8 -*- from fbchat import log, Client # Subclass fbchat.Client and override required methods class EchoBot(Client): def onMessage(self, author_id, message, thread_id, thread_type, **kwargs): self.markAsDelivered(author_id, thread_id) self.markAsRead(author_id)...
StarcoderdataPython
4801965
<filename>python/formalizeua.py #!/usr/bin/python import sys import os if len(sys.argv) < 2: print('Usage: input') exit(-1) oses = ["windows", "ios", "mac", "android", "linux"] browsers = ["chrome", "sogou", "maxthon", "safari", "firefox", "theworld", "opera", "ie"] fi = open(sys.argv[1], 'r') outname = sys...
StarcoderdataPython
1634359
import inspect import platform, re from enum import Enum from subprocess import run from pathlib import Path from coldtype.geometry import Rect from coldtype.color import normalize_color from coldtype.animation import Timeable, Frame from coldtype.animation.timeline import Timeline from coldtype.text.reader import nor...
StarcoderdataPython
1604868
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import StepLR from sklearn.model_selection import train_test_split import pandas as pd import numpy as np from models import Net def train...
StarcoderdataPython
3292934
<gh_stars>100-1000 """ for numbers a, b returns x, y such as x * a + y * b = gcd(a,b) """ def extendedEuclidean(a,b): a_old, b_old = a,b a, b = max(a, b), min(a, b) x, y, old_x, old_y = 0, 1, 1, 0 while b != 0: quotient = a // b residue = a % b a, b = b, residue x, o...
StarcoderdataPython
1742931
<reponame>punk95/Continual-Learning-With-Curiosity import torch from model import Discrete_Q_Function_CNN_NN from parameters import NN_Paramters, Algo_Param, Save_Paths, Load_Paths import numpy as np from algorithms.epsilon_greedy import epsilon_greedy from util.replay_buffer import Replay_Memory from util.reservoir_...
StarcoderdataPython
3262767
<filename>game.py<gh_stars>1-10 import pygame import sys import random import networkx as nx from edges import edges class snake_game: def __init__(self): self.w = 600 self.h = 600 self.snake_size = 20 self.fps = 40 self.screen = pygame.display.set_mode([self.w,self.h]) ...
StarcoderdataPython
3381417
<gh_stars>0 """ Test serializers' validators """ from api.enums.vs_blueprint import VsComponentType, SliceServiceType from api.tests.utils import catch_exception, error_catcher, mixer from api.serializers.requests import VsBlueprintRequestSerializer from api.serializers.vs_blueprint import VsdNsdTranslationRuleSerializ...
StarcoderdataPython
194786
<reponame>Neiron07/07033084-5cfd-4812-90a4-e4d24ffb6e3d #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' import os from flask import Flask, render_template, request, redirect, url_for, flash, send_from_directory, request from werkzeug.utils import secure_filename from datetime import dat...
StarcoderdataPython
1720585
''' module docstring for density of states ''' from numpy import exp,sqrt,pi from semic.constants.constants import value def density_of_states(m_star=0,energy=0,conduction_band_energy=0): ''' Function to find the density of quantum states as a function of energy m_star: the effective mass of a carrier...
StarcoderdataPython
11371
<filename>test/HPE3ParClient_base.py # (c) Copyright 2015 Hewlett Packard Enterprise Development LP # # 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-...
StarcoderdataPython
3268830
<filename>cartography/intel/aws/ec2/elastic_ip_addresses.py import logging from typing import Dict from typing import List import boto3 import neo4j from botocore.exceptions import ClientError from .util import get_botocore_config from cartography.util import aws_handle_regions from cartography.util import run_cleanu...
StarcoderdataPython
188752
<filename>drawer/__init__.py from .drawer import drawer
StarcoderdataPython
4827547
from ..utils import _CurrentSiteCommand, SiteManager class LogsCommand(_CurrentSiteCommand): """ Get the logs of the running site """ def run(self, **kwargs): SiteManager().logs()
StarcoderdataPython
3246327
<reponame>ADBI-george2/AnomalyDetection from __future__ import print_function, division from igraph import * import numpy as np import numpy.linalg as la from scipy.stats import pearsonr import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") __author__ = 'panzer' FEATURES = ["degree", "clus...
StarcoderdataPython