repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
frappe/frappe | frappe/website/doctype/web_page_view/web_page_view.py | 2 | 1276 | # Copyright (c) 2020, Frappe Technologies and contributors
# License: MIT. See LICENSE
import frappe
from frappe.model.document import Document
class WebPageView(Document):
pass
@frappe.whitelist(allow_guest=True)
def make_view_log(path, referrer=None, browser=None, version=None, url=None, user_tz=None):
if not ... | mit | 29abd096a304c6e8a1ba0b2149931912 | 22.2 | 91 | 0.71395 | 3.067308 | false | false | false | false |
frappe/frappe | frappe/desk/page/activity/activity.py | 3 | 1931 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
from frappe.core.doctype.activity_log.feed import get_feed_match_conditions
from frappe.utils import cint
@frappe.whitelist()
def get_feed(start, page_length):
"""get feed"""
match_conditions_communicatio... | mit | fbab554ea65a8c26cfc2ef80ef905e56 | 28.707692 | 97 | 0.708441 | 3.352431 | false | false | false | false |
frappe/frappe | frappe/core/doctype/domain/domain.py | 3 | 3893 | # Copyright (c) 2017, Frappe Technologies and contributors
# License: MIT. See LICENSE
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.model.document import Document
class Domain(Document):
"""Domain documents are created automatically when DocTypes
with "... | mit | eaa39f417df36c7cd98643f28eaec0b3 | 28.946154 | 86 | 0.682507 | 3.159903 | false | false | false | false |
richardkiss/pycoin | tests/btc/segwit_test.py | 1 | 28347 | import unittest
from pycoin.encoding.bytes32 import to_bytes_32
from pycoin.encoding.hash import double_sha256
from pycoin.encoding.hexbytes import b2h, b2h_rev, h2b
from pycoin.symbols.btc import network
# BRAIN DAMAGE
Tx = network.tx
TxOut = network.tx.TxOut
SIGHASH_ALL = network.validator.flags.SIGHASH_ALL
SIGHA... | mit | 337147f9c74cee95d3747dbba21317d3 | 57.689441 | 120 | 0.738738 | 2.374319 | false | false | false | false |
frappe/frappe | frappe/www/contact.py | 3 | 1784 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
from frappe import _
from frappe.utils import now
sitemap = 1
def get_context(context):
doc = frappe.get_doc("Contact Us Settings", "Contact Us Settings")
if doc.query_options:
query_options = [opt.st... | mit | 011457ffa98b66b3297c7672efab8647 | 24.485714 | 113 | 0.688341 | 3.180036 | false | false | false | false |
sqlalchemy/mako | mako/compat.py | 10 | 1913 | # mako/compat.py
# Copyright 2006-2022 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import collections
from importlib import util
import inspect
import sys
win32 = sys.platform.startswit... | mit | db5326768883a91976d4bdbc5884a3ef | 24.171053 | 76 | 0.667538 | 3.516544 | false | false | false | false |
frappe/frappe | frappe/model/utils/link_count.py | 3 | 1522 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
ignore_doctypes = ("DocType", "Print Format", "Role", "Module Def", "Communication", "ToDo")
def notify_link_count(doctype, name):
"""updates link count for given document"""
if hasattr(frappe.local, "li... | mit | 68f640b259afce789a87a9d062a41422 | 27.716981 | 92 | 0.665572 | 3.068548 | false | false | false | false |
klen/pylama | pylama/lint/pylama_pyflakes.py | 1 | 1804 | """Pyflakes support."""
from pyflakes import checker
from pylama.context import RunContext
from pylama.lint import LinterV2 as Abstract
m = checker.messages
CODES = {
m.UnusedImport.message: "W0611",
m.RedefinedWhileUnused.message: "W0404",
m.ImportShadowedByLoopVar.message: "W0621",
m.ImportStarUsed... | mit | e77ef39cfa653b93b2b2a03566f471ed | 31.214286 | 87 | 0.666851 | 3.35316 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/ohlc/increasing/_line.py | 1 | 6987 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Line(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "ohlc.increasing"
_path_str = "ohlc.increasing.line"
_valid_props = {"color", "dash", "width"}
... | mit | bae4476f80143421ccc138bcdf6658ec | 32.917476 | 82 | 0.527122 | 3.864491 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/carpet/_font.py | 1 | 8383 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "carpet"
_path_str = "carpet.font"
_valid_props = {"color", "family", "size"}
# color
... | mit | 1ddf46ad21c9064e9d4b39d760e09069 | 36.09292 | 82 | 0.557557 | 3.999523 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/bar/marker/_pattern.py | 1 | 19576 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Pattern(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "bar.marker"
_path_str = "bar.marker.pattern"
_valid_props = {
"bgcolor",
"b... | mit | 8541184263483bb313d498c914d57651 | 32.751724 | 82 | 0.556191 | 4.107428 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/_scattergeo.py | 1 | 86196 | from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
class Scattergeo(_BaseTraceType):
# class properties
# --------------------
_parent_path_str = ""
_path_str = "scattergeo"
_valid_props = {
"connectgaps",
"customdata",
"customdatasrc",
... | mit | 640160c1532754010a4988bb1c957caf | 35.065272 | 100 | 0.560328 | 4.568128 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/validators/image/hoverlabel/_font.py | 1 | 1858 | import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="font", parent_name="image.hoverlabel", **kwargs):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | mit | 780216b84ba17676b99011cd0a862a1d | 39.391304 | 85 | 0.531755 | 4.764103 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scattercarpet/marker/_gradient.py | 1 | 7894 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Gradient(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattercarpet.marker"
_path_str = "scattercarpet.marker.gradient"
_valid_props = {"color",... | mit | e446ea58332c5e6ab00cbc33f92db446 | 32.449153 | 84 | 0.546618 | 4.126503 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/validators/choroplethmapbox/colorbar/title/_font.py | 1 | 1570 | import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self,
plotly_name="font",
parent_name="choroplethmapbox.colorbar.title",
**kwargs,
):
super(FontValidator, self).__init__(
plotly_name=plot... | mit | df4765302216879cb2bca54180965334 | 36.380952 | 68 | 0.53121 | 4.498567 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scatterpolargl/hoverlabel/_font.py | 1 | 11226 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterpolargl.hoverlabel"
_path_str = "scatterpolargl.hoverlabel.font"
_valid_props = {"color... | mit | 2b823d9c1f8a44d732e80a5aa02bb34f | 33.018182 | 82 | 0.553269 | 4.057102 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scatterpolargl/marker/colorbar/_tickfont.py | 1 | 8529 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterpolargl.marker.colorbar"
_path_str = "scatterpolargl.marker.colorbar.tickfont"
_val... | mit | 317a63b4858f2cf528e5d5f8d870a9fc | 36.572687 | 84 | 0.56302 | 4.002346 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/splom/_diagonal.py | 1 | 2702 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Diagonal(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "splom"
_path_str = "splom.diagonal"
_valid_props = {"visible"}
# visible
# ------... | mit | fdc5d2907de088d02f903b55a3bf4ecf | 25.490196 | 82 | 0.507032 | 4.666667 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scattersmith/marker/_gradient.py | 1 | 7888 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Gradient(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattersmith.marker"
_path_str = "scattersmith.marker.gradient"
_valid_props = {"color", "... | mit | 3510ff79756ff6e58a8ffc32d0bc8257 | 32.423729 | 84 | 0.5464 | 4.101924 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/splom/marker/_colorbar.py | 1 | 78169 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ColorBar(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "splom.marker"
_path_str = "splom.marker.colorbar"
_valid_props = {
"bgcolor",
... | mit | 38f143c039c057d1ccf7cb1ed30d7ba2 | 35.089104 | 98 | 0.558342 | 4.183964 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/image/legendgrouptitle/_font.py | 1 | 8452 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "image.legendgrouptitle"
_path_str = "image.legendgrouptitle.font"
_valid_props = {"color", "fa... | mit | 597c7e457d32961642b55ac70d323161 | 36.23348 | 82 | 0.559749 | 4.011391 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scatter3d/_error_z.py | 1 | 18691 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ErrorZ(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatter3d"
_path_str = "scatter3d.error_z"
_valid_props = {
"array",
"arraym... | mit | ce19ab4639be894791941e07d5611e32 | 30.048173 | 82 | 0.545824 | 4.363997 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/validators/pie/hoverlabel/_font.py | 1 | 1856 | import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="font", parent_name="pie.hoverlabel", **kwargs):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | mit | 232527628de815d35c63d2bc1d675906 | 39.347826 | 83 | 0.53125 | 4.758974 | false | false | false | false |
plotly/plotly.py | packages/python/plotly/plotly/validators/layout/_shapes.py | 1 | 9626 | import _plotly_utils.basevalidators
class ShapesValidator(_plotly_utils.basevalidators.CompoundArrayValidator):
def __init__(self, plotly_name="shapes", parent_name="layout", **kwargs):
super(ShapesValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | mit | d9361218568f86f201ac406a0bef6885 | 50.752688 | 77 | 0.536775 | 4.873924 | false | false | false | false |
alphagov/notifications-admin | tests/app/notify_client/test_broadcast_message_client.py | 1 | 3150 | from app.notify_client.broadcast_message_api_client import BroadcastMessageAPIClient
def test_create_broadcast_message(mocker):
client = BroadcastMessageAPIClient()
mocker.patch("app.notify_client.current_user", id="1")
mock_post = mocker.patch("app.notify_client.broadcast_message_api_client.BroadcastMess... | mit | 8efae7b1a22574189f664d2c961fd2d0 | 36.5 | 109 | 0.673333 | 3.575482 | false | true | false | false |
alphagov/notifications-admin | app/models/job.py | 1 | 7279 | from datetime import timedelta
import pytz
from notifications_utils.letter_timings import (
CANCELLABLE_JOB_LETTER_STATUSES,
get_letter_timings,
letter_can_be_cancelled,
)
from notifications_utils.timezones import utc_string_to_aware_gmt_datetime
from werkzeug.utils import cached_property
from app.models ... | mit | 8cb5639831297bf5ddf7caedd32d8c45 | 28.946502 | 120 | 0.646695 | 4.095104 | false | false | false | false |
alphagov/notifications-admin | app/notify_client/notification_api_client.py | 1 | 4310 | from app.notify_client import NotifyAdminAPIClient, _attach_current_user
class NotificationApiClient(NotifyAdminAPIClient):
def get_notifications_for_service(
self,
service_id,
job_id=None,
template_type=None,
status=None,
page=None,
page_size=None,
... | mit | 91499ee4e3a037591a612d06b3989420 | 38.907407 | 117 | 0.59884 | 3.950504 | false | false | false | false |
alphagov/notifications-admin | tests/app/main/views/test_broadcast.py | 1 | 89009 | import json
import uuid
from collections import namedtuple
from functools import partial
import pytest
from flask import url_for
from freezegun import freeze_time
from tests import broadcast_message_json, sample_uuid, user_json
from tests.app.broadcast_areas.custom_polygons import BRISTOL, SKYE
from tests.conftest im... | mit | f0f6dca940ecf3a2c929ade98456c27c | 29.673216 | 120 | 0.57956 | 3.743028 | false | false | false | false |
alphagov/notifications-admin | app/main/validators.py | 1 | 7088 | import re
from abc import ABC, abstractmethod
from flask import current_app
from notifications_utils.field import Field
from notifications_utils.formatters import formatted_list
from notifications_utils.recipients import InvalidEmailError, validate_email_address
from notifications_utils.sanitise_text import SanitiseSM... | mit | efc4085fcb9a9228eee7ea26ac6f8db7 | 31.495413 | 111 | 0.619848 | 4.196682 | false | false | false | false |
alphagov/notifications-admin | tests/app/notify_client/test_letter_branding_client.py | 1 | 2675 | from unittest.mock import call
from app.notify_client.letter_branding_client import LetterBrandingClient
def test_get_letter_branding(mocker, fake_uuid):
mock_get = mocker.patch(
"app.notify_client.letter_branding_client.LetterBrandingClient.get", return_value={"foo": "bar"}
)
mock_redis_get = mo... | mit | 3b61d01f259fb776914e7e444cd4c7cd | 38.338235 | 120 | 0.697196 | 3.262195 | false | true | false | false |
alphagov/notifications-admin | tests/app/test_navigation.py | 1 | 20962 | import pytest
from flask import Flask
from app import create_app
from app.navigation import (
CaseworkNavigation,
HeaderNavigation,
MainNavigation,
Navigation,
OrgNavigation,
)
from tests.conftest import ORGANISATION_ID, SERVICE_ONE_ID, normalize_spaces
EXCLUDED_ENDPOINTS = tuple(
map(
... | mit | 90b49fcfa7a3a9f46d9787caaa36228c | 34.289562 | 120 | 0.57089 | 4.028055 | false | false | false | false |
samuelcolvin/pydantic | tests/mypy/modules/plugin_fail.py | 1 | 4101 | from typing import Any, Generic, Optional, Set, TypeVar, Union
from pydantic import BaseModel, BaseSettings, Extra, Field
from pydantic.dataclasses import dataclass
from pydantic.generics import GenericModel
class Model(BaseModel):
x: int
y: str
def method(self) -> None:
pass
class Config:
... | mit | 4ac727aee62fbf2e22a35d3f2fe7d689 | 16.986842 | 82 | 0.644477 | 3.252181 | false | true | false | false |
samuelcolvin/pydantic | pydantic/json.py | 1 | 3300 | import datetime
from collections import deque
from decimal import Decimal
from enum import Enum
from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
from pathlib import Path
from re import Pattern
from types import GeneratorType
from typing import Any, Callable, Dict, T... | mit | 679127c8837b7dd8e28ee4a393cff8b5 | 28.464286 | 102 | 0.669091 | 3.767123 | false | false | false | false |
samuelcolvin/pydantic | tests/test_construction.py | 1 | 8888 | import pickle
from typing import Any, List, Optional
import pytest
from pydantic import BaseModel, Field, PrivateAttr
from pydantic.fields import Undefined
class Model(BaseModel):
a: float
b: int = 10
def test_simple_construct():
m = Model.construct(a=3.14)
assert m.a == 3.14
assert m.b == 10
... | mit | df3205921ed096ff587cd3d3ff056e19 | 23.620499 | 120 | 0.526553 | 2.898891 | false | true | false | false |
samuelcolvin/pydantic | tests/test_networks_ipaddress.py | 1 | 17309 | from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
import pytest
from pydantic import BaseModel, IPvAnyAddress, IPvAnyInterface, IPvAnyNetwork, ValidationError
#
# ipaddress.IPv4Address
# ipaddress.IPv6Address
# pydantic.IPvAnyAddress
#
@pytest.mark.parametrize(
... | mit | 649112612963a295b4eeba9723dd845a | 30.994455 | 120 | 0.533191 | 3.155122 | false | true | false | false |
samuelcolvin/pydantic | pydantic/tools.py | 1 | 2834 | import json
from functools import lru_cache
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Optional, Type, TypeVar, Union
from .parse import Protocol, load_file, load_str_bytes
from .types import StrBytes
from .typing import display_as_type
__all__ = ('parse_file_as', 'parse_obj_as', 'parse... | mit | d81cf21440c7a46b255bf3b5d91babd9 | 29.804348 | 105 | 0.645025 | 3.268743 | false | false | false | false |
samuelcolvin/pydantic | docs/examples/types_union_discriminated_nested.py | 1 | 1061 | from typing import Literal, Union
from typing_extensions import Annotated
from pydantic import BaseModel, Field, ValidationError
class BlackCat(BaseModel):
pet_type: Literal['cat']
color: Literal['black']
black_name: str
class WhiteCat(BaseModel):
pet_type: Literal['cat']
color: Literal['white... | mit | 492dccc3c8f3281b0cd57c374bfb9b08 | 20.22 | 80 | 0.663525 | 3.129794 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/simphony/components/mzi.py | 1 | 2582 | from typing import Callable, Optional
from gdsfactory.simulation.simphony.components.mmi1x2 import mmi1x2
from gdsfactory.simulation.simphony.components.straight import (
straight as straight_function,
)
def mzi(
delta_length: float = 10.0,
length_y: float = 4.0,
length_x: float = 0.1,
splitter: ... | mit | deeb3e3028d567dc90094c37688eaab3 | 26.178947 | 73 | 0.590627 | 3.38401 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/gmeep/get_meep_geometry.py | 1 | 5618 | from typing import Dict, List, Optional, Union
import meep as mp
import numpy as np
import gdsfactory as gf
from gdsfactory.pdk import get_layer_stack
from gdsfactory.simulation.gmeep.get_material import get_material
from gdsfactory.types import ComponentSpec, CrossSectionSpec, LayerStack
def get_meep_geometry_from... | mit | 0fb78b86b38dc1089ffa40a250f02ca2 | 37.744828 | 78 | 0.55874 | 3.788267 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/litho_ruler.py | 1 | 1206 | from typing import Tuple
import gdsfactory as gf
from gdsfactory.types import LayerSpec
@gf.cell
def litho_ruler(
height: float = 2,
width: float = 0.5,
spacing: float = 2.0,
scale: Tuple[float, ...] = (3, 1, 1, 1, 1, 2, 1, 1, 1, 1),
num_marks: int = 21,
layer: LayerSpec = "WG",
) -> gf.Compo... | mit | 9a8a11ce91efa0e2c3f260045509b48d | 27.046512 | 76 | 0.625207 | 3.38764 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/gmeep/meep_adjoint_optimization.py | 1 | 12258 | from types import LambdaType
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import nlopt
import numpy as np
from meep import Block, EigenModeSource, MaterialGrid, Simulation, Vector3, Volume
from meep.adjoint import DesignRegion, EigenmodeCoefficient, OptimizationProblem
from meep.visualization i... | mit | af8f0210282d2d92e2b2929e6f1bfcb4 | 32.955679 | 112 | 0.63738 | 3.576889 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/spiral_double.py | 1 | 2009 | import gdsfactory as gf
from gdsfactory.components import bend_circular
from gdsfactory.path import spiral_archimedean
@gf.cell
def spiral_double(
min_bend_radius: float = 10.0,
separation: float = 2.0,
number_of_loops: float = 3,
npoints: int = 1000,
cross_section: gf.types.CrossSectionSpec = "st... | mit | 94c88dba227abc1b554ddc6eff5dea25 | 30.390625 | 80 | 0.645097 | 3.081288 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/lumerical/read.py | 1 | 4209 | import re
from pathlib import Path
from typing import List, Optional, Tuple
import numpy as np
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.config import logger
from gdsfactory.simulation.get_sparameters_path import (
get_sparameters_path_lumerical as get_sparameters_path,
)
... | mit | 02dab1c4f5e6de4e98843a6f32694def | 30.410448 | 123 | 0.593253 | 3.698594 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/gtidy3d/materials.py | 1 | 3129 | from functools import partial
from typing import Dict, Union
import tidy3d as td
from tidy3d.components.medium import PoleResidue
from tidy3d.components.types import ComplexNumber
from tidy3d.material_library import material_library
MATERIAL_NAME_TO_MEDIUM = {
"si": material_library["cSi"]["Li1993_293K"],
"cs... | mit | 2588e3b907f61668c7927a29204554b0 | 27.189189 | 84 | 0.646532 | 3.02027 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/tests/test_get_bundle_optical.py | 1 | 1672 | from pytest_regressions.data_regression import DataRegressionFixture
import gdsfactory as gf
from gdsfactory.component import Component
def test_get_bundle_optical(
data_regression: DataRegressionFixture, check: bool = True
) -> Component:
lengths = {}
c = gf.Component("test_get_bundle_optical")
w... | mit | ba8d757d4bfdd99574be1ac7044b75ea | 23.588235 | 78 | 0.626196 | 3.154717 | false | true | false | false |
gdsfactory/gdsfactory | gdsfactory/geometry/functions.py | 1 | 6628 | from typing import Optional, Union
import numpy as np
from numpy import cos, float64, ndarray, sin
RAD2DEG = 180.0 / np.pi
DEG2RAD = 1 / RAD2DEG
def sign_shape(pts: ndarray) -> float64:
pts2 = np.roll(pts, 1, axis=0)
dx = pts2[:, 0] - pts[:, 0]
y = pts2[:, 1] + pts[:, 1]
return np.sign((dx * y).sum(... | mit | 7b4349f8d3e9b2f2df117b858da76485 | 25.094488 | 89 | 0.560501 | 2.947088 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/sax/models.py | 1 | 7322 | import jax.numpy as jnp
from sax.typing_ import SDict
from sax.utils import reciprocal
nm = 1e-3
def straight(
*,
wl: float = 1.55,
wl0: float = 1.55,
neff: float = 2.34,
ng: float = 3.4,
length: float = 10.0,
loss: float = 0.0,
) -> SDict:
"""Dispersive straight waveguide model.
... | mit | 8cd335c67c0f62dba46b7983a9e783c2 | 24.423611 | 100 | 0.463944 | 3.338805 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/mmi2x2.py | 1 | 3655 | import gdsfactory as gf
from gdsfactory.add_padding import get_padding_points
from gdsfactory.component import Component
from gdsfactory.components.straight import straight as straight_function
from gdsfactory.components.taper import taper as taper_function
from gdsfactory.types import ComponentSpec, CrossSectionSpec, ... | mit | 596410cfc45ce535e9c2598135913d90 | 27.554688 | 87 | 0.517921 | 3.422285 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/simphony/plot_circuit.py | 1 | 2402 | from typing import Optional, Tuple
import matplotlib.pyplot as plt
import numpy as np
from simphony.models import Subcircuit
from simphony.simulators import SweepSimulator
def plot_circuit(
circuit: Subcircuit,
pin_in: str = "o1",
pins_out: Tuple[str, ...] = ("o2",),
start: float = 1500e-9,
stop:... | mit | e29d4900819e1dd669095fff6242c188 | 24.553191 | 70 | 0.600333 | 3.481159 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/bend_circular.py | 1 | 2581 | import gdsfactory as gf
from gdsfactory.add_padding import get_padding_points
from gdsfactory.component import Component
from gdsfactory.path import arc
from gdsfactory.snap import snap_to_grid
from gdsfactory.types import CrossSectionSpec
@gf.cell
def bend_circular(
angle: float = 90.0,
npoints: int = 720,
... | mit | c79cfebb1bf3ce4ae88e6abbad7b28b9 | 25.070707 | 80 | 0.563348 | 3.360677 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/add_tapers_cross_section.py | 1 | 2217 | from typing import Callable, Optional
import gdsfactory as gf
from gdsfactory.cell import cell
from gdsfactory.component import Component
from gdsfactory.components.taper_cross_section import taper_cross_section
from gdsfactory.cross_section import strip
from gdsfactory.port import select_ports_optical
from gdsfactory... | mit | af1ac04b72c9f649cb5c1b4cf5ad2604 | 33.640625 | 87 | 0.665765 | 3.464063 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/labels/ehva.py | 1 | 3766 | from typing import Dict, List, Optional, Tuple
import flatdict
import pydantic
import gdsfactory as gf
from gdsfactory.name import clean_name
from gdsfactory.snap import snap_to_grid as snap
from gdsfactory.types import Layer
class Dft(pydantic.BaseModel):
pad_size: Tuple[int, int] = (100, 100)
pad_pitch: i... | mit | a892d3c519408b484185df03a1f31296 | 26.489051 | 84 | 0.607276 | 3.395852 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/routing/route_sharp.py | 1 | 14787 | """based on phidl.routing."""
from typing import Optional, Tuple
import numpy as np
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.cross_section import CrossSection
from gdsfactory.path import Path, transition
from gdsfactory.port import Port
from gdsfactory.routing.route_quad impo... | mit | 7dcb33702c5ea71d0efae3f689f5af12 | 36.625954 | 204 | 0.598837 | 3.418169 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/simphony/components/mzi_siepic.py | 1 | 1723 | from simphony.libraries import siepic
from gdsfactory.simulation.simphony.components.mmi1x2 import mmi1x2
def mzi(L0=1, DL=100.0, L2=10.0, y_model_factory=mmi1x2, wg=siepic.Waveguide):
"""Mzi circuit model.
Args:
L0 (um): vertical length for both and top arms
DL (um): bottom arm extra length... | mit | 5f1167bedfe61ae86d0d3b148d6e0629 | 23.267606 | 86 | 0.548462 | 3.076786 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/via_stack.py | 1 | 3301 | from typing import Optional, Tuple
from numpy import floor
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.components.compass import compass
from gdsfactory.components.via import via1, via2, viac
from gdsfactory.tech import LAYER
from gdsfactory.types import ComponentSpec, LayerSpec... | mit | ee6962aa40f9156031c3f792670d4aa1 | 27.213675 | 88 | 0.578007 | 2.957885 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/modes/find_neff_ng_dw_dh.py | 1 | 4412 | """Compute group and effective index for different waveguide widths and heights.
Reproduce Yufei thesis results with MPB.
https://www.photonics.intec.ugent.be/contact/people.asp?ID=332
"""
import pathlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pydantic
from scipy.interpolate i... | mit | 9df5618a56c9f10d6071a43be9319a0d | 26.403727 | 81 | 0.602901 | 3.201742 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/routing/get_bundle.py | 1 | 24019 | """Routes bundles of ports (river routing).
get bundle is the generic river routing function
get_bundle calls different function depending on the port orientation.
- get_bundle_same_axis: ports facing each other with arbitrary pitch on each side
- get_bundle_corner: 90Deg / 270Deg between ports with arbitrary pitch... | mit | ed3ac2fe9840e979afbfbac399ff4c9f | 31.37062 | 121 | 0.589492 | 3.499272 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/wafer.py | 1 | 1050 | import gdsfactory as gf
from gdsfactory.types import Component, ComponentSpec, Optional, Tuple
_cols_200mm_wafer = (2, 6, 6, 8, 8, 6, 6, 2)
@gf.cell
def wafer(
reticle: ComponentSpec = "die",
cols: Tuple[int, ...] = _cols_200mm_wafer,
xspacing: Optional[float] = None,
yspacing: Optional[float] = None... | mit | 18b655ee0d969b2369c463df1eb7b7e5 | 25.923077 | 74 | 0.622857 | 3.354633 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/samples/01_component_pcell.py | 1 | 2851 | """Based on phidl tutorial.
We'll start by assuming we have a function straight() which already
exists and makes us a simple straight waveguide. Many functions like
this exist in the gdsfactory.components library and are ready-for-use.
We write this one out fully just so it's explicitly clear what's
happening
"""
im... | mit | 5cdc50bc34abb4c075eb6a65ad04e138 | 37.013333 | 87 | 0.642231 | 3.688228 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/tests/test_name_with_decorator.py | 1 | 2112 | import gdsfactory as gf
@gf.cell
def straight_with_pins(**kwargs):
c = gf.Component()
ref = c << gf.components.straight()
c.add_ports(ref.ports)
return c
def test_name_with_decorator():
c = gf.Component("test_name_with_decorator")
c1 = c << straight_with_pins(decorator=gf.add_padding)
c2... | mit | 172361004f7573f0ef9b2beb385314e4 | 29.608696 | 88 | 0.624527 | 3.190332 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/modes/get_mode_solver_coupler.py | 1 | 6920 | import pathlib
import tempfile
from typing import Optional, Tuple, Union
import meep as mp
import numpy as np
import pydantic
from meep import mpb
mpb.Verbosity(0)
tmp = pathlib.Path(tempfile.TemporaryDirectory().name).parent / "meep"
tmp.mkdir(exist_ok=True)
Floats = Tuple[float, ...]
@pydantic.validate_argument... | mit | 46044249853bf8e0e4c1150b234504e2 | 32.110048 | 86 | 0.498266 | 3.609807 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/gtidy3d/write_sparameters.py | 1 | 10294 | import time
import numpy as np
import tidy3d as td
from omegaconf import OmegaConf
import gdsfactory as gf
from gdsfactory.config import logger
from gdsfactory.serialization import clean_value_json
from gdsfactory.simulation import port_symmetries
from gdsfactory.simulation.get_sparameters_path import (
get_spara... | mit | 5e88b9d7ea4cbad0bf94bdbbccca5008 | 36.569343 | 88 | 0.648436 | 3.70421 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/coh_tx_dual_pol.py | 1 | 5107 | from typing import Optional
import gdsfactory as gf
from gdsfactory.cell import cell
from gdsfactory.component import Component
from gdsfactory.routing.get_route import get_route
from gdsfactory.types import ComponentSpec, CrossSectionSpec
@cell
def coh_tx_dual_pol(
splitter: ComponentSpec = "mmi1x2",
combin... | mit | 19313d07c5c727385f1e13487a7516c2 | 30.524691 | 82 | 0.531623 | 3.576331 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/C.py | 1 | 1168 | from typing import Tuple
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.types import LayerSpec
@gf.cell
def C(
width: float = 1.0,
size: Tuple[float, float] = (10.0, 20.0),
layer: LayerSpec = "WG",
) -> Component:
"""C geometry with ports on both ends.
based o... | mit | 0a2ce9af2e1c6e24c20293946da09b15 | 19.491228 | 83 | 0.480308 | 3.002571 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/pdk.py | 1 | 19613 | """PDK stores layers, cross_sections, cell functions ..."""
import logging
import pathlib
import warnings
from functools import partial
from typing import Any, Callable, Optional
import numpy as np
from omegaconf import DictConfig
from pydantic import BaseModel, Field, validator
from gdsfactory.components import cel... | mit | e781e5cfb6c35ee92bef15669b12b243 | 35.728464 | 88 | 0.592056 | 4.110878 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/simulation/gmeep/get_simulation_grating_farfield.py | 1 | 15663 | """FIXME: needs some work.
- figure out get_farfield outputs
- add tutorial in docs/notebooks/plugins/meep/002_gratings.ipynb
- add filecache
- benchmark with lumerical and tidy3d
- add tests
"""
from typing import Any, Dict, Optional
import meep as mp
import numpy as np
from gdsfactory.types import Floats
nm = 1e... | mit | cc053f4807b4eb5a790496735d8e1968 | 28.608696 | 88 | 0.588265 | 3.249585 | false | false | false | false |
davidsandberg/facenet | tmp/mnist_noise_labels.py | 1 | 15432 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | mit | bf27d8d7eb9106dda88a15b6aa8fb73c | 43.472622 | 127 | 0.601801 | 3.779574 | false | true | false | false |
jgorset/facepy | facepy/graph_api.py | 1 | 16285 | try:
import simplejson as json
except ImportError:
import json # flake8: noqa
import requests
import hashlib
import hmac
import logging
try:
import urllib.parse as urlparse
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
import urlparse
from decimal import D... | mit | 07595ae61f74a0a3d0fefe06d60151d3 | 35.188889 | 150 | 0.55198 | 4.635639 | false | false | false | false |
davidsandberg/facenet | src/facenet.py | 3 | 23366 | """Functions for building the face recognition network.
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# 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, includ... | mit | 5db670bcec6193b01f3858214dfb49bf | 39.921191 | 146 | 0.628135 | 3.378054 | false | false | false | false |
jgorset/facepy | facepy/utils.py | 1 | 2686 | from datetime import datetime, timedelta
try:
from urllib.parse import parse_qs
except ImportError:
from urlparse import parse_qs
from facepy.graph_api import GraphAPI
def get_extended_access_token(access_token, application_id, application_secret_key, api_version=None):
"""
Get an extended OAuth acc... | mit | b4b8e4ed38f20509f2c8bdba5b8711d6 | 33 | 104 | 0.672003 | 4.22327 | false | false | false | false |
davidsandberg/facenet | tmp/rename_casia_directories.py | 4 | 1350 | import shutil
import argparse
import os
import sys
def main(args):
identity_map = {}
with open(os.path.expanduser(args.map_file_name), "r") as f:
for line in f:
fields = line.split(' ')
dir_name = fields[0]
class_name = fields[1].replace('\n', '').replace('\r', ''... | mit | 7f74edd4600a967966f8ce633d16899d | 35.486486 | 132 | 0.591111 | 3.6 | false | false | false | false |
davidsandberg/facenet | test/restore_test.py | 5 | 7104 | # MIT License
#
# Copyright (c) 2016 David Sandberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | mit | ed029d98cc71b0fec31beb77466fc047 | 38.254144 | 118 | 0.598395 | 3.7888 | false | false | false | false |
davidsandberg/facenet | contributed/export_embeddings.py | 1 | 8585 | """
Exports the embeddings and labels of a directory of images as numpy arrays.
Typicall usage expect the image directory to be of the openface/facenet form and
the images to be aligned. Simply point to your model and your image directory:
python facenet/contributed/export_embeddings.py ~/models/facenet/20170216-0... | mit | 0a665f6cbe4a0ff30fe2896682244720 | 42.57868 | 132 | 0.659988 | 3.687715 | false | false | false | false |
davidsandberg/facenet | tmp/vggverydeep19.py | 4 | 4024 | """Load the VGG imagenet model into TensorFlow.
Download the model from http://www.robots.ox.ac.uk/~vgg/research/very_deep/
and point to the file 'imagenet-vgg-verydeep-19.mat'
"""
import numpy as np
from scipy import io
import tensorflow as tf
def load(filename, images):
vgg19 = io.loadmat(filename)
vgg19Laye... | mit | 8372c9a675bf007cfec4c9396569acde | 81.122449 | 162 | 0.63171 | 2.686248 | false | false | false | false |
stanfordnmbl/osim-rl | tests/test.segfault.py | 1 | 1435 | import os
import opensim
opensim.Body('block', 0.0001 , opensim.Vec3(0), opensim.Inertia(1,1,.0001,0,0,0) );
opensim.Body('block', 0.0001 , opensim.Vec3(0), opensim.Inertia(1,1,.0001,0,0,0) );
model_path = os.path.join(os.path.dirname(__file__), '../osim/models/gait9dof18musc.osim')
def test(model_path, visualize):
... | mit | 596808f6b31ca2e448a35ade9528705d | 30.195652 | 95 | 0.603484 | 2.928571 | false | true | false | false |
stanfordnmbl/osim-rl | osim/env/arm.py | 1 | 4609 | import math
import numpy as np
import os
from .utils.mygym import convert_to_gym
import gym
import opensim
import random
from .osim import OsimEnv
class Arm2DEnv(OsimEnv):
model_path = os.path.join(os.path.dirname(__file__), '../models/arm2dof6musc.osim')
time_limit = 200
target_x = 0
target_y = 0
... | mit | 0f03aa3cdcce4db4898ccfb3057d43cd | 37.416667 | 165 | 0.567151 | 3.248062 | false | false | false | false |
uccser/cs-unplugged | csunplugged/at_home/management/commands/loadactivities.py | 1 | 2260 | """Module for the custom Django loadactivities command."""
import os.path
from django.core.management.base import BaseCommand
from django.conf import settings
from utils.BaseLoader import BaseLoader
from utils.LoaderFactory import LoaderFactory
from utils.errors.MissingRequiredFieldError import MissingRequiredFieldErr... | mit | 25085c26c6ba8c6fb40f479c69713894 | 34.873016 | 112 | 0.606637 | 4.788136 | false | false | false | false |
uccser/cs-unplugged | csunplugged/topics/migrations/0093_auto_20190208_0157.py | 1 | 5667 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-02-08 01:57
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('topics', '0092_auto_20181105_0901'),
]
... | mit | be89a046d9484d0f9997892e54f34e52 | 34.198758 | 90 | 0.550909 | 4.479842 | false | false | false | false |
uccser/cs-unplugged | csunplugged/topics/migrations/0063_auto_20170610_2139.py | 1 | 5029 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-10 21:39
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('topics', '0062_auto_20170609_0424'),
]
operations ... | mit | 2a62a2194432e97c02279abd91e2568c | 38.289063 | 164 | 0.593557 | 4.669452 | false | false | false | false |
uccser/cs-unplugged | csunplugged/plugging_it_in/urls.py | 1 | 1093 | """URL routing for the plugging_it_in application."""
from django.urls import path
from django.conf.urls import url
from . import views
app_name = "plugging_it_in"
urlpatterns = [
url(
r"^$",
views.IndexView.as_view(),
name="index"
),
path(
'about/',
views.AboutVie... | mit | f77310023ebc5849da82fc418d34c5cf | 23.288889 | 114 | 0.534309 | 3.302115 | false | false | false | false |
uccser/cs-unplugged | csunplugged/tests/resources/views/test_index_view.py | 1 | 2179 | from http import HTTPStatus
from django.test import tag
from django.urls import reverse
from tests.BaseTestWithDB import BaseTestWithDB
from tests.resources.ResourcesTestDataGenerator import ResourcesTestDataGenerator
@tag("resource")
class IndexViewTest(BaseTestWithDB):
def __init__(self, *args, **kwargs):
... | mit | d896a1c715d043cf993e903c524e6d88 | 33.587302 | 85 | 0.608077 | 4.446939 | false | true | false | false |
uccser/cs-unplugged | csunplugged/topics/management/commands/_GlossaryTermsLoader.py | 1 | 1862 | """Custom loader for loading glossary terms."""
from os import listdir
from django.db import transaction
from utils.language_utils import get_default_language
from topics.models import GlossaryTerm
from utils.TranslatableModelLoader import TranslatableModelLoader
class GlossaryTermsLoader(TranslatableModelLoader):
... | mit | 486be25096cd2f0f5887611fbd66db3c | 37 | 101 | 0.647691 | 4.15625 | false | false | false | false |
uccser/cs-unplugged | csunplugged/at_a_distance/management/commands/_LessonLoader.py | 1 | 5661 | """Custom loader for loading an at a distance lesson."""
from django.db import transaction
from utils.TranslatableModelLoader import TranslatableModelLoader
from utils.check_required_files import find_image_files
from utils.errors.CouldNotFindYAMLFileError import CouldNotFindYAMLFileError
from utils.errors.MissingRequ... | mit | c4d73b9e9913c2d282660dd4fe81dc2f | 36.490066 | 95 | 0.598657 | 4.52518 | false | false | false | false |
uccser/cs-unplugged | csunplugged/topics/migrations/0087_auto_20171122_0324.py | 1 | 10654 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-22 03:24
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('topics', '0086_auto_20171108_0840'),
]
operat... | mit | 812e369daea1cd2acde5cb6fcd0cd1a3 | 32.503145 | 127 | 0.549559 | 4.614119 | false | false | false | false |
uccser/cs-unplugged | csunplugged/at_a_distance/views.py | 1 | 3641 | """Views for the at a distance application."""
import os.path
from django.views import generic
from django.utils import translation
from django.conf import settings
from django.http import JsonResponse
from django.utils.translation import get_language
from at_a_distance.models import Lesson
from at_a_distance.settings... | mit | 01b4a311b0671be7ab6a83b419424e6e | 28.601626 | 109 | 0.648723 | 3.840717 | false | false | false | false |
jewettaij/moltemplate | moltemplate/lttree_postprocess.py | 1 | 20953 | #!/usr/bin/env python
# Author: Andrew Jewett (jewett.aij at g mail)
# License: MIT License (See LICENSE.md)
# Copyright (c) 2013
# All rights reserved.
"""
lttree_postprocess.py
This is a stand-alone python script which checks the files created by
lttree.py to insure that the standard instance-variables... | mit | 28472614c94242fd5fdd9b190a23e343 | 46.947368 | 131 | 0.422231 | 4.504084 | false | false | false | false |
jewettaij/moltemplate | moltemplate/bonds_by_type.py | 1 | 16436 | #!/usr/bin/env python
# Author: Andrew Jewett (jewett.aij at g mail)
# License: MIT License (See LICENSE.md)
# Copyright (c) 2013
"""
bonds_by_type.py reads a LAMMPS data file (or an excerpt of a LAMMPS)
data file containing bonded many-body interactions by atom type
(and bond type), and generates a list... | mit | fb027005de05101961dc5764b5ee933c | 42.366755 | 132 | 0.48047 | 4.064293 | false | false | false | false |
jewettaij/moltemplate | examples/coarse_grained/DNA_models/dsDNA_only/2strands/3bp_2particles/simple_dna_example/measure_torsional_persistence_length/raw2blockaverage.py | 4 | 2902 | #!/usr/bin/env python
err_msg = """
Typical Usage:
raw2blockaverage.py N [scale_inv] < coordinate_file
Coordinates read from the file coordinate_file are averaged in blocks
of size N, and printed to the standard output, followed by a blank line.
Excluding blank lines, the number of lines in the output e... | mit | 09e32bb98ff551931d2348fca64e9d08 | 27.174757 | 78 | 0.620951 | 3.301479 | false | false | false | false |
jewettaij/moltemplate | moltemplate/extract_espresso_atom_types.py | 2 | 1114 | #!/usr/bin/env python
# Author: Andrew Jewett (jewett.aij at g mail)
# License: MIT License (See LICENSE.md)
# Copyright (c) 2013, Regents of the University of California
import sys
def main():
for line_orig in sys.stdin:
line = line_orig.rstrip('\n')
comment = ''
if '#' in line_orig:
... | mit | db09a60c48b686cac69041dda8cf71f4 | 31.764706 | 67 | 0.477558 | 3.427692 | false | false | false | false |
jewettaij/moltemplate | examples/coarse_grained/DNA_models/dsDNA_only/2strands/3bp_2particles/simple_dna_example/measure_torsional_persistence_length/raw2subtractlines.py | 4 | 3200 | #!/usr/bin/env python
err_msg = """
Typical Usage:
raw2subtractlines.py [-norm] < coordinate_file
Coordinates read from one line of the file are subtracted from coordinates
from the next line of the file (if it contains coordinates) and printed to
the standard output. Blank lines in the input file are ... | mit | 00919cd0882ef8532aebf3ea7a201ab4 | 26.350427 | 80 | 0.575938 | 3.255341 | false | false | false | false |
jewettaij/moltemplate | moltemplate/lttree.py | 1 | 47134 | #!/usr/bin/env python
# Author: Andrew Jewett (jewett.aij at g mail)
# http://www.moltemplate.org
# http://www.chem.ucsb.edu/~sheagroup
# License: MIT License (See LICENSE.md)
# Copyright (c) 2013, Regents of the University of California
# All rights reserved.
"""
lttree.py
lttree.py is an extension... | mit | 4bb24ce2f97575b30e3b02999642bdde | 47.046891 | 130 | 0.51046 | 4.328588 | false | false | false | false |
jewettaij/moltemplate | moltemplate/force_fields/cooke_deserno_supporting_files/gen_potential-cooke.py | 2 | 4380 | #!/usr/bin/python
import os,sys
from fractions import Fraction
from numpy import *
### PARAMETERS ###
sigma = 1.00
epsilon = 1.00
b_hh = 0.95 * sigma
b_ht = 0.95 * sigma
b_tt = 1.00 * sigma
r_init = 0.000001
r_max = sigma * 3.
r_space = 0.01
##################
### INPUTS ###
if len(sys.argv) == 2:
w_cut = float(... | mit | 310626e372107b2b487c2f448b31851e | 29.416667 | 116 | 0.585616 | 2.302839 | false | false | false | false |
psf/black | src/blackd/middlewares.py | 1 | 1585 | from typing import TYPE_CHECKING, Any, Awaitable, Callable, Iterable, TypeVar
from aiohttp.web_request import Request
from aiohttp.web_response import StreamResponse
if TYPE_CHECKING:
F = TypeVar("F", bound=Callable[..., Any])
middleware: Callable[[F], F]
else:
try:
from aiohttp.web_middlewares im... | mit | e825426b52ac7a0f75c167a7a4e87e9d | 34.222222 | 88 | 0.644795 | 4.149215 | false | false | false | false |
psf/black | tests/data/simple_cases/comments4.py | 2 | 3531 | from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
MyLovelyCompanyTeamProjectComponent, # NOT DRY
)
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
MyLovelyCompanyTeamProjectComponent as component, # DRY
)
class C:
@pytest.ma... | mit | adf9a6d9237f3d2323982d6de8dba632 | 36.56383 | 88 | 0.543472 | 3.796774 | false | false | false | false |
psf/black | src/black/__init__.py | 1 | 45425 | import io
import json
import platform
import re
import sys
import tokenize
import traceback
from contextlib import contextmanager
from dataclasses import replace
from datetime import datetime
from enum import Enum
from json.decoder import JSONDecodeError
from pathlib import Path
from typing import (
Any,
Dict,
... | mit | 15a44675e7b1ddb29c7816988e8aa77b | 30.998591 | 88 | 0.595582 | 3.907237 | false | false | false | false |
psf/black | src/black/report.py | 1 | 3451 | """
Summarize Black runs to users.
"""
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from click import style
from black.output import err, out
class Changed(Enum):
NO = 0
CACHED = 1
YES = 2
class NothingChanged(UserWarning):
"""Raised when reformatted code is the... | mit | 3463b8f861795ca5967ea9700e3b742f | 31.556604 | 88 | 0.572877 | 4.084024 | false | false | false | false |
psf/black | src/black/trans.py | 1 | 82244 | """
String transformers that can split and merge strings.
"""
import re
import sys
from abc import ABC, abstractmethod
from collections import defaultdict
from dataclasses import dataclass
from typing import (
Any,
Callable,
ClassVar,
Collection,
Dict,
Iterable,
Iterator,
List,
Optio... | mit | 76e65fd2d3a40c08b399aa00b8a25a88 | 36.265066 | 88 | 0.560953 | 4.256055 | false | false | false | false |
psf/black | tests/data/simple_cases/comments2.py | 2 | 7638 | from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
MyLovelyCompanyTeamProjectComponent # NOT DRY
)
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
MyLovelyCompanyTeamProjectComponent as component # DRY
)
# Please keep __all__ alph... | mit | 0c5daadfd40b9c3c6351c08ebdbbf16a | 21.333333 | 132 | 0.539146 | 3.822823 | false | false | false | false |
psf/black | tests/data/preview/comments9.py | 1 | 4268 | # Test for https://github.com/psf/black/issues/246.
some = statement
# This comment should be split from the statement above by two lines.
def function():
pass
some = statement
# This multiline comments section
# should be split from the statement
# above by two lines.
def function():
pass
some = statement... | mit | 969d99f5c0189b21ed8e159c736c3556 | 15.80315 | 69 | 0.679944 | 3.790409 | false | false | false | false |
neuropoly/spinalcordtoolbox | spinalcordtoolbox/csa_pmj.py | 1 | 4498 | #!/usr/bin/env python
# -*- coding: utf-8
# Functions to get distance from PMJ for processing segmentation data
# Author: Sandrine Bédard
import logging
import numpy as np
from spinalcordtoolbox.image import Image
from spinalcordtoolbox.centerline.core import get_centerline
logger = logging.getLogger(__name__)
NEAR_... | mit | 96457b5e241621968f8514a672d8e5f5 | 51.290698 | 147 | 0.706916 | 3.549329 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.